Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Left align upload page #1320

Merged
merged 2 commits into from
Jan 27, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
82 changes: 41 additions & 41 deletions frontend/src/routes/Upload.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,6 @@ const Upload: React.FC<Props> = ({ knownRolesRef }) => {

return (
<div css={{
margin: "0 auto",
height: "100%",
display: "flex",
flexDirection: "column",
Expand Down Expand Up @@ -232,8 +231,7 @@ const UploadMain: React.FC<UploadMainProps> = ({ knownRoles }) => {
alignItems: "stretch",
gap: 32,
width: "100%",
maxWidth: 800,
margin: "0 auto",
maxWidth: 900,
}}>
<UploadState state={uploadState.current} />
<div>
Expand Down Expand Up @@ -353,7 +351,7 @@ const UploadErrorBox: React.FC<{ error: unknown }> = ({ error }) => {


return (
<div css={{ margin: "0 auto" }}>
<div css={{ maxWidth: 750 }}>
<Card kind="error">
<ErrorDisplay info={info} failedAction={t("upload.errors.failed-to-upload")} />
</Card>
Expand Down Expand Up @@ -761,7 +759,7 @@ const MetaDataEdit: React.FC<MetaDataEditProps> = ({ onSave, disabled, knownRole
}],
]);

const { register, handleSubmit, control, formState: { errors } } = useForm<Metadata>({
const { register, handleSubmit, control, formState: { isValid, errors } } = useForm<Metadata>({
mode: "onChange",
defaultValues: { acl: defaultAcl },
});
Expand Down Expand Up @@ -806,41 +804,43 @@ const MetaDataEdit: React.FC<MetaDataEditProps> = ({ onSave, disabled, knownRole
{boxError(errors.title?.message)}
</InputContainer>

{/* Description */}
<InputContainer>
<label htmlFor={descriptionFieldId}>{t("upload.metadata.description")}</label>
<TextArea id={descriptionFieldId} {...register("description")} />
</InputContainer>

{/* Series */}
<InputContainer>
<label htmlFor={seriesFieldId}>
{t("series.series")}
{CONFIG.upload.requireSeries && <FieldIsRequiredNote />}
<WithTooltip
tooltip={t("upload.metadata.note-writable-series")}
tooltipCss={{ width: 400 }}
css={{
display: "inline-block",
verticalAlign: "middle",
fontWeight: "normal",
marginLeft: 8,
}}
>
<span><LuInfo tabIndex={0} /></span>
</WithTooltip>
</label>
<VideoListSelector
type="series"
inputId={seriesFieldId}
writableOnly
menuPlacement="top"
onChange={data => onSeriesChange({ opencastId: data?.opencastId })}
onBlur={seriesField.onBlur}
required={CONFIG.upload.requireSeries}
/>
{boxError(errors.series?.message)}
</InputContainer>
<div css={{ maxWidth: 750 }}>
{/* Description */}
<InputContainer>
<label htmlFor={descriptionFieldId}>{t("upload.metadata.description")}</label>
<TextArea id={descriptionFieldId} {...register("description")} />
</InputContainer>

{/* Series */}
<InputContainer>
<label htmlFor={seriesFieldId}>
{t("series.series")}
{CONFIG.upload.requireSeries && <FieldIsRequiredNote />}
<WithTooltip
tooltip={t("upload.metadata.note-writable-series")}
tooltipCss={{ width: 400 }}
css={{
display: "inline-block",
verticalAlign: "middle",
fontWeight: "normal",
marginLeft: 8,
}}
>
<span><LuInfo tabIndex={0} /></span>
</WithTooltip>
</label>
<VideoListSelector
type="series"
inputId={seriesFieldId}
writableOnly
menuPlacement="top"
onChange={data => onSeriesChange({ opencastId: data?.opencastId })}
onBlur={seriesField.onBlur}
required={CONFIG.upload.requireSeries}
/>
{boxError(errors.series?.message)}
</InputContainer>
</div>

{/* ACL */}
<InputContainer>
Expand Down Expand Up @@ -880,7 +880,7 @@ const MetaDataEdit: React.FC<MetaDataEditProps> = ({ onSave, disabled, knownRole
{/* Submit button */}
<Button
kind="call-to-action"
disabled={disabled}
disabled={!isValid || disabled}
css={{ marginTop: 32, marginBottom: 160 }}
onClick={onSubmit}>
{t("upload.metadata.save")}
Expand Down
Loading