🏷️(frontend) adapt title types
We recently changed the default title behavior. It can now be undefined, we have to change the types accordingly.
This commit is contained in:
@@ -33,11 +33,13 @@ export const DocTitle = ({ doc }: DocTitleProps) => {
|
||||
};
|
||||
|
||||
interface DocTitleTextProps {
|
||||
title: string;
|
||||
title?: string;
|
||||
}
|
||||
|
||||
export const DocTitleText = ({ title }: DocTitleTextProps) => {
|
||||
const { isMobile } = useResponsiveStore();
|
||||
const { untitledDocument } = useTrans();
|
||||
|
||||
return (
|
||||
<Text
|
||||
as="h2"
|
||||
@@ -45,7 +47,7 @@ export const DocTitleText = ({ title }: DocTitleTextProps) => {
|
||||
$size={isMobile ? 'h4' : 'h2'}
|
||||
$variation="1000"
|
||||
>
|
||||
{title}
|
||||
{title || untitledDocument}
|
||||
</Text>
|
||||
);
|
||||
};
|
||||
|
||||
@@ -6,7 +6,7 @@ import { useCunninghamTheme } from '@/cunningham';
|
||||
import { DocTitleText } from './DocTitle';
|
||||
|
||||
interface DocVersionHeaderProps {
|
||||
title: string;
|
||||
title?: string;
|
||||
}
|
||||
|
||||
export const DocVersionHeader = ({ title }: DocVersionHeaderProps) => {
|
||||
|
||||
@@ -22,7 +22,7 @@ import { css } from 'styled-components';
|
||||
|
||||
import { Box, Text } from '@/components';
|
||||
import { useEditorStore } from '@/features/docs/doc-editor';
|
||||
import { Doc } from '@/features/docs/doc-management';
|
||||
import { Doc, useTrans } from '@/features/docs/doc-management';
|
||||
|
||||
import { TemplatesOrdering, useTemplates } from '../api/useTemplates';
|
||||
import { downloadFile, exportResolveFileUrl } from '../utils';
|
||||
@@ -51,6 +51,7 @@ export const ModalExport = ({ onClose, doc }: ModalExportProps) => {
|
||||
const [format, setFormat] = useState<DocDownloadFormat>(
|
||||
DocDownloadFormat.PDF,
|
||||
);
|
||||
const { untitledDocument } = useTrans();
|
||||
|
||||
const templateOptions = useMemo(() => {
|
||||
const templateOptions = (templates?.pages || [])
|
||||
@@ -78,7 +79,7 @@ export const ModalExport = ({ onClose, doc }: ModalExportProps) => {
|
||||
|
||||
setIsExporting(true);
|
||||
|
||||
const title = doc.title
|
||||
const title = (doc.title || untitledDocument)
|
||||
.toLowerCase()
|
||||
.normalize('NFD')
|
||||
.replace(/[\u0300-\u036f]/g, '')
|
||||
|
||||
@@ -36,7 +36,7 @@ export type Base64 = string;
|
||||
|
||||
export interface Doc {
|
||||
id: string;
|
||||
title: string;
|
||||
title?: string;
|
||||
content: Base64;
|
||||
creator: string;
|
||||
is_favorite: boolean;
|
||||
|
||||
Reference in New Issue
Block a user