mirror of
https://github.com/cpvalente/ontime.git
synced 2026-08-14 20:03:52 +00:00
refactor: migrate project data
This commit is contained in:
committed by
Carlos Valente
parent
1fc6f9b3ea
commit
6f34e1006b
@@ -22,8 +22,8 @@ interface ProjectCreateFromProps {
|
||||
type ProjectCreateFormValues = {
|
||||
title?: string;
|
||||
description?: string;
|
||||
backstageInfo?: string;
|
||||
backstageUrl?: string;
|
||||
info?: string;
|
||||
url?: string;
|
||||
custom?: { title: string; value: string }[];
|
||||
};
|
||||
|
||||
@@ -107,18 +107,12 @@ export default function ProjectCreateForm(props: ProjectCreateFromProps) {
|
||||
<Input fluid maxLength={100} placeholder='Euro Love, Malmö 2024' {...register('description')} />
|
||||
</label>
|
||||
<label>
|
||||
Backstage info
|
||||
<Textarea
|
||||
fluid
|
||||
maxLength={150}
|
||||
placeholder='Wi-Fi password: 1234'
|
||||
resize='vertical'
|
||||
{...register('backstageInfo')}
|
||||
/>
|
||||
Project info
|
||||
<Textarea fluid maxLength={150} placeholder='Wi-Fi password: 1234' resize='vertical' {...register('info')} />
|
||||
</label>
|
||||
<label>
|
||||
Backstage QR code Url
|
||||
<Input fluid placeholder={documentationUrl} {...register('backstageUrl')} />
|
||||
Project QR code URL
|
||||
<Input fluid placeholder={documentationUrl} {...register('url')} />
|
||||
</label>
|
||||
<Panel.Section>
|
||||
<Panel.ListItem>
|
||||
|
||||
@@ -61,16 +61,16 @@ export default function ProjectData() {
|
||||
validateLogo(file);
|
||||
const response = await uploadProjectLogo(file);
|
||||
|
||||
setValue('projectLogo', response.data.logoFilename, {
|
||||
setValue('logo', response.data.logoFilename, {
|
||||
shouldDirty: true,
|
||||
});
|
||||
} catch (error) {
|
||||
const message = maybeAxiosError(error);
|
||||
setError('projectLogo', { message });
|
||||
setError('logo', { message });
|
||||
}
|
||||
};
|
||||
|
||||
const { ref, ...projectLogoRest } = register('projectLogo');
|
||||
const { ref, ...projectLogoRest } = register('logo');
|
||||
|
||||
const uploadInputRef = useRef<HTMLInputElement | null>(null);
|
||||
|
||||
@@ -81,7 +81,7 @@ export default function ProjectData() {
|
||||
const handleDeleteLogo = (e: React.MouseEvent<HTMLButtonElement>) => {
|
||||
e.preventDefault();
|
||||
e.stopPropagation();
|
||||
setValue('projectLogo', null, {
|
||||
setValue('logo', null, {
|
||||
shouldDirty: true,
|
||||
});
|
||||
};
|
||||
@@ -149,12 +149,12 @@ export default function ProjectData() {
|
||||
onChange={handleUploadProjectLogo}
|
||||
/>
|
||||
<Panel.Card className={style.uploadLogoCard}>
|
||||
{watch('projectLogo') ? (
|
||||
{watch('logo') ? (
|
||||
<>
|
||||
<img src={`${projectLogoPath}/${watch('projectLogo')}`} />
|
||||
<img src={`${projectLogoPath}/${watch('logo')}`} />
|
||||
<Button
|
||||
variant='subtle-destructive'
|
||||
disabled={isSubmitting || !watch('projectLogo')}
|
||||
disabled={isSubmitting || !watch('logo')}
|
||||
onClick={handleDeleteLogo}
|
||||
>
|
||||
<IoTrash />
|
||||
@@ -167,7 +167,7 @@ export default function ProjectData() {
|
||||
Upload logo
|
||||
</Button>
|
||||
)}
|
||||
{errors?.projectLogo?.message && <Panel.Error>{errors.projectLogo.message}</Panel.Error>}
|
||||
{errors?.logo?.message && <Panel.Error>{errors.logo.message}</Panel.Error>}
|
||||
</Panel.Card>
|
||||
</label>
|
||||
</Panel.Section>
|
||||
@@ -177,18 +177,18 @@ export default function ProjectData() {
|
||||
<Input fluid maxLength={100} placeholder='Euro Love, Malmö 2024' {...register('description')} />
|
||||
</label>
|
||||
<label>
|
||||
Backstage info
|
||||
Project info
|
||||
<Textarea
|
||||
fluid
|
||||
maxLength={150}
|
||||
placeholder='Wi-Fi password: 1234'
|
||||
resize='vertical'
|
||||
{...register('backstageInfo')}
|
||||
{...register('info')}
|
||||
/>
|
||||
</label>
|
||||
<label>
|
||||
Backstage QR code URL
|
||||
<Input fluid placeholder={documentationUrl} {...register('backstageUrl')} />
|
||||
Project QR code URL
|
||||
<Input fluid placeholder={documentationUrl} {...register('url')} />
|
||||
</label>
|
||||
<Panel.Section style={{ marginTop: 0 }}>
|
||||
<Panel.ListItem>
|
||||
|
||||
@@ -20,7 +20,7 @@ function MessageControlExport() {
|
||||
<ProtectRoute permission='editor'>
|
||||
<div className={style.messages} data-testid='panel-messages-control'>
|
||||
{!isExtracted && <Corner onClick={(event) => handleLinks('messagecontrol', event)} />}
|
||||
{isExtracted && <ViewNavigationMenu supressSettings />}
|
||||
{isExtracted && <ViewNavigationMenu suppressSettings />}
|
||||
|
||||
<div className={classes}>
|
||||
<ErrorBoundary>
|
||||
|
||||
@@ -18,7 +18,7 @@ function TimerControlExport() {
|
||||
<ProtectRoute permission='editor'>
|
||||
<div className={style.playback} data-testid='panel-timer-control'>
|
||||
{!isExtracted && <Corner onClick={(event) => handleLinks('timercontrol', event)} />}
|
||||
{isExtracted && <ViewNavigationMenu supressSettings />}
|
||||
{isExtracted && <ViewNavigationMenu suppressSettings />}
|
||||
|
||||
<div className={style.content}>
|
||||
<ErrorBoundary>
|
||||
|
||||
@@ -36,7 +36,7 @@ function RundownExport() {
|
||||
data-testid='panel-rundown'
|
||||
>
|
||||
<FinderPlacement />
|
||||
<ViewNavigationMenu supressSettings />
|
||||
<ViewNavigationMenu suppressSettings />
|
||||
<div className={style.content}>
|
||||
<ErrorBoundary>
|
||||
<ContextMenu>
|
||||
|
||||
@@ -125,7 +125,7 @@ export default function Clock(props: ClockProps) {
|
||||
}}
|
||||
data-testid='clock-view'
|
||||
>
|
||||
{general?.projectLogo && <ViewLogo name={general.projectLogo} className='logo' />}
|
||||
{general?.logo && <ViewLogo name={general.logo} className='logo' />}
|
||||
<ViewParamsEditor viewOptions={clockOptions} />
|
||||
<SuperscriptTime
|
||||
time={clock}
|
||||
|
||||
@@ -160,7 +160,7 @@ export default function MinimalTimer(props: MinimalTimerProps) {
|
||||
}}
|
||||
data-testid='minimal-timer'
|
||||
>
|
||||
{general?.projectLogo && <ViewLogo name={general.projectLogo} className='logo' />}
|
||||
{general?.logo && <ViewLogo name={general.logo} className='logo' />}
|
||||
<ViewParamsEditor viewOptions={MINIMAL_TIMER_OPTIONS} />
|
||||
{showEndMessage ? (
|
||||
<div className='end-message'>{viewSettings.endMessage}</div>
|
||||
|
||||
Reference in New Issue
Block a user