Fix about default description behavior
This commit is contained in:
parent
4f5461e327
commit
2f99f8f558
@ -1,7 +1,6 @@
|
|||||||
import { getDescriptionWithFallback } from '@/about';
|
|
||||||
import AboutPageClient from '@/about/AboutPageClient';
|
import AboutPageClient from '@/about/AboutPageClient';
|
||||||
import { getAboutDataCached } from '@/about/data';
|
import { getAboutDataCached } from '@/about/data';
|
||||||
import { SHOW_ABOUT_PAGE } from '@/app/config';
|
import { ABOUT_DESCRIPTION_DEFAULT, SHOW_ABOUT_PAGE } from '@/app/config';
|
||||||
import { PATH_ROOT } from '@/app/path';
|
import { PATH_ROOT } from '@/app/path';
|
||||||
import { getDataForCategoriesCached } from '@/category/cache';
|
import { getDataForCategoriesCached } from '@/category/cache';
|
||||||
import {
|
import {
|
||||||
@ -42,7 +41,7 @@ export default async function AboutPage() {
|
|||||||
getDataForCategoriesCached().catch(() => (NULL_CATEGORY_DATA)),
|
getDataForCategoriesCached().catch(() => (NULL_CATEGORY_DATA)),
|
||||||
]);
|
]);
|
||||||
|
|
||||||
const description = getDescriptionWithFallback(about);
|
const description = about?.description || ABOUT_DESCRIPTION_DEFAULT;
|
||||||
|
|
||||||
const descriptionHtml = description
|
const descriptionHtml = description
|
||||||
? <div
|
? <div
|
||||||
|
|||||||
@ -3,7 +3,7 @@
|
|||||||
import { PATH_ABOUT } from '@/app/path';
|
import { PATH_ABOUT } from '@/app/path';
|
||||||
import LinkWithStatus from '@/components/LinkWithStatus';
|
import LinkWithStatus from '@/components/LinkWithStatus';
|
||||||
import { useState } from 'react';
|
import { useState } from 'react';
|
||||||
import { About, AboutInsert, getDescriptionWithFallback } from '.';
|
import { About, AboutInsert } from '.';
|
||||||
import FieldsetWithStatus from '@/components/FieldsetWithStatus';
|
import FieldsetWithStatus from '@/components/FieldsetWithStatus';
|
||||||
import AdminChildPage from '@/components/AdminChildPage';
|
import AdminChildPage from '@/components/AdminChildPage';
|
||||||
import { updateAboutAction } from './actions';
|
import { updateAboutAction } from './actions';
|
||||||
@ -11,6 +11,7 @@ import SubmitButtonWithStatus from '@/components/SubmitButtonWithStatus';
|
|||||||
import { Photo } from '@/photo';
|
import { Photo } from '@/photo';
|
||||||
import { useAppText } from '@/i18n/state/client';
|
import { useAppText } from '@/i18n/state/client';
|
||||||
import FieldsetPhotoChooser from '@/photo/form/FieldsetPhotoChooser';
|
import FieldsetPhotoChooser from '@/photo/form/FieldsetPhotoChooser';
|
||||||
|
import { ABOUT_DESCRIPTION_DEFAULT } from '@/app/config';
|
||||||
|
|
||||||
export default function AdminAboutEditPage({
|
export default function AdminAboutEditPage({
|
||||||
about,
|
about,
|
||||||
@ -72,7 +73,7 @@ export default function AdminAboutEditPage({
|
|||||||
label="Description"
|
label="Description"
|
||||||
type="textarea"
|
type="textarea"
|
||||||
value={aboutForm?.description ?? ''}
|
value={aboutForm?.description ?? ''}
|
||||||
placeholder={getDescriptionWithFallback(about)}
|
placeholder={ABOUT_DESCRIPTION_DEFAULT}
|
||||||
onChange={description => setAboutForm(form =>
|
onChange={description => setAboutForm(form =>
|
||||||
({ ...form, description }))}
|
({ ...form, description }))}
|
||||||
/>
|
/>
|
||||||
|
|||||||
@ -1,5 +1,3 @@
|
|||||||
import { ABOUT_DESCRIPTION_DEFAULT } from '@/app/config';
|
|
||||||
|
|
||||||
export interface AboutInsert {
|
export interface AboutInsert {
|
||||||
id: number
|
id: number
|
||||||
title?: string
|
title?: string
|
||||||
@ -13,7 +11,3 @@ export interface About extends AboutInsert {
|
|||||||
createdAt: Date
|
createdAt: Date
|
||||||
updatedAt: Date
|
updatedAt: Date
|
||||||
}
|
}
|
||||||
|
|
||||||
export const getDescriptionWithFallback = (about?: About) =>
|
|
||||||
about?.description ||
|
|
||||||
ABOUT_DESCRIPTION_DEFAULT;
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user