fix(client): 🐛 do not allow private resumes to be viewable or downloadable through the link

This commit is contained in:
Amruth Pillai
2023-07-12 15:59:22 +02:00
parent 5ef4bfcb6b
commit 1c2d796c50
121 changed files with 3193 additions and 2068 deletions

View File

@ -1,13 +1,13 @@
import { joiResolver } from '@hookform/resolvers/joi';
import { Add, DriveFileRenameOutline } from '@mui/icons-material';
import { Button, Slider, TextField } from '@mui/material';
import { SectionPath, Skill } from 'schema';
import Joi from 'joi';
import get from 'lodash/get';
import isEmpty from 'lodash/isEmpty';
import { useTranslation } from 'next-i18next';
import { useEffect, useMemo } from 'react';
import { Controller, useForm } from 'react-hook-form';
import { SectionPath, Skill } from 'schema';
import ArrayInput from '@/components/shared/ArrayInput';
import BaseModal from '@/components/shared/BaseModal';
@ -45,8 +45,8 @@ const SkillModal: React.FC = () => {
const item: FormData = get(payload, 'item', null);
const isEditMode = useMemo(() => !!item, [item]);
const addText = useMemo(() => t<string>('builder.common.actions.add', { token: heading }), [t, heading]);
const editText = useMemo(() => t<string>('builder.common.actions.edit', { token: heading }), [t, heading]);
const addText = useMemo(() => t('builder.common.actions.add', { token: heading }), [t, heading]);
const editText = useMemo(() => t('builder.common.actions.edit', { token: heading }), [t, heading]);
const { reset, control, handleSubmit } = useForm<FormData>({
defaultValues: defaultState,
@ -68,7 +68,7 @@ const SkillModal: React.FC = () => {
setModalState({
modal: `builder.${path}`,
state: { open: false },
})
}),
);
reset(defaultState);
@ -96,7 +96,7 @@ const SkillModal: React.FC = () => {
<TextField
required
autoFocus
label={t<string>('builder.common.form.name.label')}
label={t('builder.common.form.name.label')}
error={!!fieldState.error}
helperText={fieldState.error?.message}
{...field}
@ -109,7 +109,7 @@ const SkillModal: React.FC = () => {
control={control}
render={({ field, fieldState }) => (
<TextField
label={t<string>('builder.common.form.level.label')}
label={t('builder.common.form.level.label')}
error={!!fieldState.error}
helperText={fieldState.error?.message}
{...field}
@ -122,11 +122,13 @@ const SkillModal: React.FC = () => {
control={control}
render={({ field }) => (
<div className="col-span-2">
<h4 className="mb-3 font-semibold">{t<string>('builder.common.form.levelNum.label')}</h4>
<h4 className="mb-3 font-semibold">{t('builder.common.form.levelNum.label')}</h4>
<div className="px-3">
<Slider
{...field}
name={field.name}
value={field.value}
onChange={(_, value) => field.onChange(value as number)}
marks={[
{
value: 0,
@ -146,7 +148,7 @@ const SkillModal: React.FC = () => {
defaultValue={0}
color="secondary"
valueLabelDisplay="auto"
aria-label={t<string>('builder.common.form.levelNum.label')}
aria-label={t('builder.common.form.levelNum.label')}
/>
</div>
</div>
@ -158,7 +160,7 @@ const SkillModal: React.FC = () => {
control={control}
render={({ field, fieldState }) => (
<ArrayInput
label={t<string>('builder.common.form.keywords.label')}
label={t('builder.common.form.keywords.label')}
value={field.value}
onChange={field.onChange}
errors={fieldState.error}