refactor: Update Dockerfile and improve custom template handling
This commit is contained in:
parent
5e4ee9e039
commit
da84c79cb0
3 changed files with 14 additions and 24 deletions
|
|
@ -1,5 +1,5 @@
|
|||
# syntax=docker/dockerfile:1.4
|
||||
FROM python:3.11-slim-bookworm
|
||||
FROM python:3.11-slim-trixie
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
# syntax=docker/dockerfile:1.4
|
||||
FROM python:3.11-slim-bookworm
|
||||
FROM python:3.11-slim-trixie
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
|
|
|
|||
|
|
@ -216,25 +216,17 @@ export function useCustomTemplateSummaries() {
|
|||
setLoading(true);
|
||||
setError(null);
|
||||
|
||||
const data = await TemplateService.getCustomTemplateSummaries();
|
||||
// const mappedTemplates: CustomTemplates[] = data.filter(item => item.total_layouts && item.total_layouts > 0).map((item) => {
|
||||
|
||||
// return {
|
||||
// id: item.id,
|
||||
// name: item.name || "Custom Template",
|
||||
// layoutCount: item.total_layouts,
|
||||
// isCustom: true as const,
|
||||
// }
|
||||
// });
|
||||
|
||||
const mappedTemplates: CustomTemplates[] = data.presentations.map((item: any) => {
|
||||
return {
|
||||
id: item.template.id,
|
||||
name: item.template.name || "Custom Template",
|
||||
layoutCount: 0,
|
||||
isCustom: true as const,
|
||||
}
|
||||
});
|
||||
const data: TemplateSummary[] = await TemplateService.getCustomTemplateSummaries();
|
||||
const mappedTemplates: CustomTemplates[] = data
|
||||
.filter((item) => item.total_layouts && item.total_layouts > 0)
|
||||
.map((item) => {
|
||||
return {
|
||||
id: item.id,
|
||||
name: item.name || "Custom Template",
|
||||
layoutCount: item.total_layouts,
|
||||
isCustom: true as const,
|
||||
};
|
||||
});
|
||||
|
||||
|
||||
setTemplates(mappedTemplates);
|
||||
|
|
@ -389,7 +381,6 @@ export function useCustomTemplateDetails(templateDetail: { id: string, name: str
|
|||
export function useCustomTemplatePreview(presentationId: string) {
|
||||
const [previewLayouts, setPreviewLayouts] = useState<CompiledLayout[]>([]);
|
||||
const [loading, setLoading] = useState(true);
|
||||
const [totalLayouts, setTotalLayouts] = useState(0);
|
||||
|
||||
|
||||
|
||||
|
|
@ -400,7 +391,6 @@ export function useCustomTemplatePreview(presentationId: string) {
|
|||
try {
|
||||
setLoading(true);
|
||||
const data = await TemplateService.getCustomTemplateDetails(presentationId);
|
||||
setTotalLayouts(data.layouts.length);
|
||||
// Compile first 4 layouts for preview
|
||||
const compiled: CompiledLayout[] = [];
|
||||
const layoutsToPreview = data.layouts.slice(0, 4);
|
||||
|
|
@ -427,7 +417,7 @@ export function useCustomTemplatePreview(presentationId: string) {
|
|||
fetchPreviews();
|
||||
}, [presentationId]);
|
||||
|
||||
return { previewLayouts, loading: loading, totalLayouts: totalLayouts };
|
||||
return { previewLayouts, loading: loading };
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue