From 1c2d796c506779a3b1af4a2c66ba17b3b5dd8e2b Mon Sep 17 00:00:00 2001 From: Amruth Pillai Date: Wed, 12 Jul 2023 15:59:22 +0200 Subject: [PATCH] fix(client): :bug: do not allow private resumes to be viewable or downloadable through the link --- README.md | 3 +- client/.eslintrc.json | 3 + .../Center/ArtboardController.module.scss | 4 +- .../build/Center/ArtboardController.tsx | 32 +- .../build/Center/Center.module.scss | 2 +- client/components/build/Center/Center.tsx | 6 +- .../build/Center/Header.module.scss | 4 +- client/components/build/Center/Header.tsx | 22 +- .../components/build/Center/Page.module.scss | 4 +- client/components/build/Center/Page.tsx | 4 +- .../build/LeftSidebar/LeftSidebar.module.scss | 8 +- .../build/LeftSidebar/LeftSidebar.tsx | 18 +- .../build/LeftSidebar/sections/Basics.tsx | 22 +- .../build/LeftSidebar/sections/Location.tsx | 21 +- .../LeftSidebar/sections/PhotoFilters.tsx | 14 +- .../LeftSidebar/sections/PhotoUpload.tsx | 6 +- .../build/LeftSidebar/sections/Profiles.tsx | 6 +- .../build/LeftSidebar/sections/Section.tsx | 6 +- .../LeftSidebar/sections/SectionSettings.tsx | 6 +- .../RightSidebar/RightSidebar.module.scss | 8 +- .../build/RightSidebar/RightSidebar.tsx | 4 +- .../build/RightSidebar/sections/CustomCSS.tsx | 4 +- .../build/RightSidebar/sections/Export.tsx | 14 +- .../RightSidebar/sections/Layout.module.scss | 8 +- .../build/RightSidebar/sections/Layout.tsx | 12 +- .../RightSidebar/sections/Links.module.scss | 2 +- .../build/RightSidebar/sections/Links.tsx | 22 +- .../build/RightSidebar/sections/Settings.tsx | 44 +- .../build/RightSidebar/sections/Sharing.tsx | 10 +- .../build/RightSidebar/sections/Templates.tsx | 2 +- .../build/RightSidebar/sections/Theme.tsx | 10 +- .../RightSidebar/sections/Typography.tsx | 18 +- .../dashboard/ResumeCard.module.scss | 2 +- .../dashboard/ResumePreview.module.scss | 2 +- client/components/dashboard/ResumePreview.tsx | 22 +- client/components/home/Actions.tsx | 44 + client/components/home/Background.tsx | 16 + client/components/home/Footer.tsx | 47 + client/components/home/Header.tsx | 24 + client/components/home/Hero.tsx | 0 client/components/home/Pattern.tsx | 28 + .../{landing => home}/Testimony.module.scss | 2 +- .../{landing => home}/Testimony.tsx | 0 client/components/home/sections/Logo.tsx | 51 + client/components/home/sections/Stats.tsx | 27 + client/components/shared/Avatar.tsx | 4 +- .../components/shared/BaseModal.module.scss | 6 +- client/components/shared/Copyright.tsx | 19 + client/components/shared/Footer.tsx | 2 +- client/components/shared/Heading.tsx | 8 +- client/components/shared/Icon.tsx | 27 + client/components/shared/List.module.scss | 2 +- client/components/shared/List.tsx | 4 +- client/components/shared/ListItem.module.scss | 2 +- client/components/shared/ListItem.tsx | 8 +- client/components/shared/Logo.tsx | 23 +- client/components/ui/Separator.tsx | 25 + client/config/theme.ts | 22 +- client/constants/tilt.ts | 11 + client/modals/auth/ForgotPasswordModal.tsx | 10 +- client/modals/auth/LoginModal.tsx | 14 +- client/modals/auth/RegisterModal.tsx | 18 +- client/modals/auth/ResetPasswordModal.tsx | 10 +- client/modals/auth/UserProfileModal.tsx | 16 +- client/modals/builder/sections/AwardModal.tsx | 16 +- .../builder/sections/CertificateModal.tsx | 16 +- .../modals/builder/sections/CustomModal.tsx | 34 +- .../builder/sections/EducationModal.tsx | 26 +- .../modals/builder/sections/InterestModal.tsx | 10 +- .../modals/builder/sections/LanguageModal.tsx | 20 +- .../modals/builder/sections/ProfileModal.tsx | 16 +- .../modals/builder/sections/ProjectModal.tsx | 22 +- .../builder/sections/PublicationModal.tsx | 16 +- .../builder/sections/ReferenceModal.tsx | 16 +- client/modals/builder/sections/SkillModal.tsx | 22 +- .../builder/sections/VolunteerModal.tsx | 20 +- client/modals/builder/sections/WorkModal.tsx | 28 +- client/modals/dashboard/CreateResumeModal.tsx | 12 +- .../modals/dashboard/ImportExternalModal.tsx | 20 +- client/modals/dashboard/RenameResumeModal.tsx | 8 +- client/package.json | 71 +- client/pages/[username]/[slug]/build.tsx | 8 +- client/pages/[username]/[slug]/index.tsx | 14 +- client/pages/_app.tsx | 6 + client/pages/_document.tsx | 2 +- client/pages/dashboard.tsx | 10 +- client/pages/home.tsx | 68 + client/pages/index.tsx | 50 +- client/pages/r/[shortId].tsx | 3 - client/public/favicon.ico | Bin 103343 -> 69694 bytes client/public/icon/dark.svg | 8 + client/public/icon/light.svg | 8 + .../public/images/brand-logos/dark/amazon.svg | 33 + .../public/images/brand-logos/dark/google.svg | 25 + .../images/brand-logos/dark/postman.svg | 15 + .../public/images/brand-logos/dark/twilio.svg | 12 + .../images/brand-logos/dark/zalando.svg | 14 + .../images/brand-logos/light/amazon.svg | 33 + .../images/brand-logos/light/google.svg | 25 + .../images/brand-logos/light/postman.svg | 15 + .../images/brand-logos/light/twilio.svg | 12 + .../images/brand-logos/light/zalando.svg | 14 + client/public/images/logos/logo.png | Bin 4016 -> 0 bytes client/public/images/logos/logo.svg | 17 - client/public/logo/dark.svg | 18 + client/public/logo/light.svg | 18 + client/services/react-query.ts | 12 +- client/styles/globals.scss | 8 +- client/styles/pages/Home.module.scss | 2 +- client/styles/pages/Preview.module.scss | 4 +- client/styles/partials/_forms.scss | 6 +- client/tailwind.config.js | 13 +- client/utils/date.ts | 2 +- client/utils/styles.ts | 15 +- docker-compose.yml => compose-dev.yml | 6 +- compose.yml | 65 + package.json | 20 +- pnpm-lock.yaml | 3378 +++++++++-------- schema/package.json | 4 +- server/package.json | 62 +- server/src/resume/resume.service.ts | 18 +- 121 files changed, 3193 insertions(+), 2068 deletions(-) create mode 100644 client/components/home/Actions.tsx create mode 100644 client/components/home/Background.tsx create mode 100644 client/components/home/Footer.tsx create mode 100644 client/components/home/Header.tsx create mode 100644 client/components/home/Hero.tsx create mode 100644 client/components/home/Pattern.tsx rename client/components/{landing => home}/Testimony.module.scss (75%) rename client/components/{landing => home}/Testimony.tsx (100%) create mode 100644 client/components/home/sections/Logo.tsx create mode 100644 client/components/home/sections/Stats.tsx create mode 100644 client/components/shared/Copyright.tsx create mode 100644 client/components/shared/Icon.tsx create mode 100644 client/components/ui/Separator.tsx create mode 100644 client/constants/tilt.ts create mode 100644 client/pages/home.tsx create mode 100644 client/public/icon/dark.svg create mode 100644 client/public/icon/light.svg create mode 100644 client/public/images/brand-logos/dark/amazon.svg create mode 100644 client/public/images/brand-logos/dark/google.svg create mode 100644 client/public/images/brand-logos/dark/postman.svg create mode 100644 client/public/images/brand-logos/dark/twilio.svg create mode 100644 client/public/images/brand-logos/dark/zalando.svg create mode 100644 client/public/images/brand-logos/light/amazon.svg create mode 100644 client/public/images/brand-logos/light/google.svg create mode 100644 client/public/images/brand-logos/light/postman.svg create mode 100644 client/public/images/brand-logos/light/twilio.svg create mode 100644 client/public/images/brand-logos/light/zalando.svg delete mode 100644 client/public/images/logos/logo.png delete mode 100644 client/public/images/logos/logo.svg create mode 100644 client/public/logo/dark.svg create mode 100644 client/public/logo/light.svg rename docker-compose.yml => compose-dev.yml (92%) create mode 100644 compose.yml diff --git a/README.md b/README.md index 10341ee7..bd20b03c 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -Reactive Resume +Reactive Resume # Reactive Resume @@ -30,6 +30,7 @@ You have complete control over what goes into your resume, how it looks, what co - [Donations](#donations) - [GitHub Sponsor](#github-sponsor) - [PayPal](#paypal) + - [GitHub Star History](#github-star-history) - [Infrastructure](#infrastructure) - [Contributors Wall](#contributors-wall) - [License](#license) diff --git a/client/.eslintrc.json b/client/.eslintrc.json index cbc0003e..823a26af 100644 --- a/client/.eslintrc.json +++ b/client/.eslintrc.json @@ -12,6 +12,9 @@ "@next/next/no-img-element": "off", "@next/next/no-sync-scripts": "off", + // React + "react/no-unescaped-entities": "off", + // React Hooks "react-hooks/exhaustive-deps": "off", diff --git a/client/components/build/Center/ArtboardController.module.scss b/client/components/build/Center/ArtboardController.module.scss index c8a0367d..a4a47d4d 100644 --- a/client/components/build/Center/ArtboardController.module.scss +++ b/client/components/build/Center/ArtboardController.module.scss @@ -15,7 +15,7 @@ .controller { @apply z-20 flex items-center justify-center shadow-lg; @apply flex rounded-l-full rounded-r-full px-4; - @apply bg-neutral-50 dark:bg-neutral-800; + @apply bg-zinc-50 dark:bg-zinc-900; @apply opacity-70 transition-opacity duration-200 hover:opacity-100; > button { @@ -23,6 +23,6 @@ } > hr { - @apply mx-3 h-5 w-0.5 bg-neutral-900/40 dark:bg-neutral-50/20; + @apply mx-3 h-5 w-0.5 bg-zinc-900/40 dark:bg-zinc-50/20; } } diff --git a/client/components/build/Center/ArtboardController.tsx b/client/components/build/Center/ArtboardController.tsx index 57322739..7cbd0b52 100644 --- a/client/components/build/Center/ArtboardController.tsx +++ b/client/components/build/Center/ArtboardController.tsx @@ -12,7 +12,6 @@ import { ZoomOut, } from '@mui/icons-material'; import { ButtonBase, Divider, Tooltip, useMediaQuery, useTheme } from '@mui/material'; -import clsx from 'clsx'; import dayjs from 'dayjs'; import get from 'lodash/get'; import { useTranslation } from 'next-i18next'; @@ -26,6 +25,7 @@ import { printResumeAsPdf, PrintResumeAsPdfParams } from '@/services/printer'; import { togglePageBreakLine, togglePageOrientation, toggleSidebar } from '@/store/build/buildSlice'; import { useAppDispatch, useAppSelector } from '@/store/hooks'; import getResumeUrl from '@/utils/getResumeUrl'; +import { cn } from '@/utils/styles'; import styles from './ArtboardController.module.scss'; @@ -60,7 +60,7 @@ const ArtboardController: React.FC = ({ zoomIn, zoomO const url = getResumeUrl(resume, { withHost: true }); await navigator.clipboard.writeText(url); - toast.success(t('common.toast.success.resume-link-copied')); + toast.success(t('common.toast.success.resume-link-copied')); }; const handleExportPDF = async () => { @@ -77,40 +77,40 @@ const ArtboardController: React.FC = ({ zoomIn, zoomO return (
- ('builder.controller.tooltip.undo')}> - + + - ('builder.controller.tooltip.redo')}> - + + - ('builder.controller.tooltip.zoom-in')}> + zoomIn(0.25)}> - ('builder.controller.tooltip.zoom-out')}> + zoomOut(0.25)}> - ('builder.controller.tooltip.center-artboard')}> + centerView(0.95)}> @@ -120,10 +120,10 @@ const ArtboardController: React.FC = ({ zoomIn, zoomO {isDesktop && ( <> - ('builder.controller.tooltip.toggle-orientation')}> + {orientation === 'vertical' ? ( @@ -133,13 +133,13 @@ const ArtboardController: React.FC = ({ zoomIn, zoomO - ('builder.controller.tooltip.toggle-page-break-line')}> + - ('builder.controller.tooltip.toggle-sidebars')}> + @@ -149,13 +149,13 @@ const ArtboardController: React.FC = ({ zoomIn, zoomO )} - ('builder.controller.tooltip.copy-link')}> + - ('builder.controller.tooltip.export-pdf')}> + diff --git a/client/components/build/Center/Center.module.scss b/client/components/build/Center/Center.module.scss index db0e887c..1c86ed27 100644 --- a/client/components/build/Center/Center.module.scss +++ b/client/components/build/Center/Center.module.scss @@ -1,7 +1,7 @@ .center { @apply mx-0 flex flex-grow pt-12 lg:pt-16; @apply transition-[margin-left,margin-right] duration-200; - @apply bg-neutral-200 dark:bg-neutral-900; + @apply bg-zinc-100 dark:bg-zinc-900; } .wrapper { diff --git a/client/components/build/Center/Center.tsx b/client/components/build/Center/Center.tsx index f9390505..92c8984d 100644 --- a/client/components/build/Center/Center.tsx +++ b/client/components/build/Center/Center.tsx @@ -1,9 +1,9 @@ -import clsx from 'clsx'; import get from 'lodash/get'; import isEmpty from 'lodash/isEmpty'; import { TransformComponent, TransformWrapper } from 'react-zoom-pan-pinch'; import { useAppSelector } from '@/store/hooks'; +import { cn } from '@/utils/styles'; import ArtboardController from './ArtboardController'; import styles from './Center.module.scss'; @@ -19,7 +19,7 @@ const Center = () => { if (isEmpty(resume)) return null; return ( -
+
{ <>
svg { - @apply text-base text-neutral-100; + @apply text-base text-zinc-100; } } diff --git a/client/components/build/Center/Header.tsx b/client/components/build/Center/Header.tsx index 604d1c3e..18a8d0f6 100644 --- a/client/components/build/Center/Header.tsx +++ b/client/components/build/Center/Header.tsx @@ -20,7 +20,6 @@ import { useMediaQuery, useTheme, } from '@mui/material'; -import clsx from 'clsx'; import get from 'lodash/get'; import { useRouter } from 'next/router'; import { useTranslation } from 'next-i18next'; @@ -37,6 +36,7 @@ import { setSidebarState, toggleSidebar } from '@/store/build/buildSlice'; import { useAppDispatch, useAppSelector } from '@/store/hooks'; import { setModalState } from '@/store/modal/modalSlice'; import getResumeUrl from '@/utils/getResumeUrl'; +import { cn } from '@/utils/styles'; import styles from './Header.module.scss'; @@ -102,7 +102,7 @@ const Header = () => { }, }, }, - }) + }), ); }; @@ -132,14 +132,14 @@ const Header = () => { const url = getResumeUrl(resume, { withHost: true }); await navigator.clipboard.writeText(url); - toast.success(t('common.toast.success.resume-link-copied')); + toast.success(t('common.toast.success.resume-link-copied')); }; return ( { - {t('builder.header.menu.rename')} + {t('builder.header.menu.rename')} - {t('builder.header.menu.duplicate')} + {t('builder.header.menu.duplicate')} {resume.public ? ( @@ -180,27 +180,27 @@ const Header = () => { - {t('builder.header.menu.share-link')} + {t('builder.header.menu.share-link')} ) : ( - ('builder.header.menu.tooltips.share-link')}> +
- {t('builder.header.menu.share-link')} + {t('builder.header.menu.share-link')}
)} - ('builder.header.menu.tooltips.delete')}> + - {t('builder.header.menu.delete')} + {t('builder.header.menu.delete')} diff --git a/client/components/build/Center/Page.module.scss b/client/components/build/Center/Page.module.scss index dffed45d..e8489134 100644 --- a/client/components/build/Center/Page.module.scss +++ b/client/components/build/Center/Page.module.scss @@ -18,8 +18,8 @@ content: 'Page Break'; top: calc(297mm - 19px); - @apply absolute w-full border-b border-dashed border-neutral-800/75; - @apply flex items-end justify-end pr-2 pb-0.5 text-xs font-bold text-neutral-800/75; + @apply absolute w-full border-b border-dashed border-zinc-900/75; + @apply flex items-end justify-end pr-2 pb-0.5 text-xs font-bold text-zinc-900/75; @apply print:hidden; :global(.preview-mode) &, diff --git a/client/components/build/Center/Page.tsx b/client/components/build/Center/Page.tsx index 32542ccc..3d8e3bf9 100644 --- a/client/components/build/Center/Page.tsx +++ b/client/components/build/Center/Page.tsx @@ -49,9 +49,7 @@ const Page: React.FC = ({ page, showPageNumbers = false }) => { {TemplatePage && }
- {showPageNumbers && ( -

{`${t('builder.common.glossary.page')} ${page + 1}`}

- )} + {showPageNumbers &&

{`${t('builder.common.glossary.page')} ${page + 1}`}

}
); }; diff --git a/client/components/build/LeftSidebar/LeftSidebar.module.scss b/client/components/build/LeftSidebar/LeftSidebar.module.scss index 086d3895..d335048b 100644 --- a/client/components/build/LeftSidebar/LeftSidebar.module.scss +++ b/client/components/build/LeftSidebar/LeftSidebar.module.scss @@ -1,12 +1,12 @@ .container { @apply h-screen w-[95vw] md:w-[70vw] lg:w-[50vw] xl:w-[30vw] 2xl:w-[28vw]; - @apply bg-neutral-50 text-neutral-900 dark:bg-neutral-900 dark:text-neutral-50; - @apply relative flex border-r-2 border-neutral-50/10; + @apply bg-zinc-100 text-zinc-900 dark:bg-zinc-900 dark:text-zinc-100; + @apply relative flex border-r-2 border-zinc-100/10; nav { @apply absolute inset-y-0 left-0; @apply w-14 py-4 md:w-16 md:px-2; - @apply bg-neutral-100 shadow dark:bg-neutral-800; + @apply bg-zinc-100 shadow dark:bg-zinc-900; @apply flex flex-col items-center justify-between; hr { @@ -29,7 +29,7 @@ > section { @apply grid gap-4; @apply pt-5 pb-7 first:pt-0; - @apply border-b border-neutral-900/10 last:border-b-0 dark:border-neutral-50/10; + @apply border-b border-zinc-900/10 last:border-b-0 dark:border-zinc-100/10; hr { @apply my-2; diff --git a/client/components/build/LeftSidebar/LeftSidebar.tsx b/client/components/build/LeftSidebar/LeftSidebar.tsx index bdc9f41d..47cbdf6b 100644 --- a/client/components/build/LeftSidebar/LeftSidebar.tsx +++ b/client/components/build/LeftSidebar/LeftSidebar.tsx @@ -8,7 +8,7 @@ import React, { ReactComponentElement, useMemo } from 'react'; import { Section as SectionRecord } from 'schema'; import { validate } from 'uuid'; -import Logo from '@/components/shared/Logo'; +import Icon from '@/components/shared/Icon'; import { getCustomSections, getSectionsByType, left } from '@/config/sections'; import { setSidebarState } from '@/store/build/buildSlice'; import { useAppDispatch, useAppSelector } from '@/store/hooks'; @@ -69,7 +69,7 @@ const LeftSidebar = () => { sectionsComponents.push(
{component} -
+ , ); if (addMore) { @@ -89,7 +89,7 @@ const LeftSidebar = () => { elements.push(
{newComponent} -
+ , ); } sectionsComponents.push(...elements); @@ -112,7 +112,9 @@ const LeftSidebar = () => {