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