diff --git a/apps/web/src/components/ImageSelectorContext.tsx b/apps/web/src/components/ImageSelectorContext.tsx index 6824a8f..61589e8 100644 --- a/apps/web/src/components/ImageSelectorContext.tsx +++ b/apps/web/src/components/ImageSelectorContext.tsx @@ -18,6 +18,7 @@ type ImageSelectorContextData = { outputFormat: OutputFormat; outputSizingMode: OutputSizingMode; processing: boolean; + downloadNameTemplate: string; }; export const ImageSelectorContext = createContextId('image-selector-context'); @@ -29,6 +30,7 @@ export const ImageSelectorContextProvider = component$(() => { outputFormat: 'png', outputSizingMode: 'fixed_size', processing: false, + downloadNameTemplate: 'Presize.io_{timestamp}', }); useContextProvider(ImageSelectorContext, context); diff --git a/apps/web/src/routes/index.tsx b/apps/web/src/routes/index.tsx index d9384de..b8ca291 100644 --- a/apps/web/src/routes/index.tsx +++ b/apps/web/src/routes/index.tsx @@ -37,7 +37,12 @@ export default component$(() => { { - imageSelectorContext.outputFormat = e.target.value as OutputFormat; + const target = e.target as HTMLSelectElement | null; + if (!target) { + return; + } + + imageSelectorContext.outputFormat = target.value as OutputFormat; }} > @@ -93,6 +113,27 @@ export default component$(() => { +
+
+ + { + const target = e.target as HTMLInputElement | null; + if (!target) { + return; + } + + imageSelectorContext.downloadNameTemplate = target.value; + }} + /> +
+