diff --git a/components/public/export-language-dialog.tsx b/components/public/export-language-dialog.tsx
deleted file mode 100644
index b65721d..0000000
--- a/components/public/export-language-dialog.tsx
+++ /dev/null
@@ -1,53 +0,0 @@
-"use client";
-
-import { Button } from "@/components/ui/button";
-import {
- Dialog,
- DialogContent,
- DialogDescription,
- DialogHeader,
- DialogTitle,
-} from "@/components/ui/dialog";
-import {
- ExportLanguageOption,
- type ExportLanguage,
-} from "@/components/public/export-language";
-
-export function ExportLanguageDialog({
- open,
- onOpenChange,
- onSelect,
-}: {
- open: boolean;
- onOpenChange: (open: boolean) => void;
- onSelect: (language: ExportLanguage) => void;
-}) {
- return (
-
- );
-}
diff --git a/components/public/guide-image-export.tsx b/components/public/guide-image-export.tsx
index dce0b37..d2b6dce 100644
--- a/components/public/guide-image-export.tsx
+++ b/components/public/guide-image-export.tsx
@@ -13,13 +13,13 @@ import {
DialogHeader,
DialogTitle,
} from "@/components/ui/dialog";
-import { ExportLanguageDialog } from "@/components/public/export-language-dialog";
import {
ExportLanguageToggle,
useExportLanguage,
type ExportLanguage,
} from "@/components/public/export-language";
import { Spinner } from "@/components/ui/spinner";
+import { ToggleGroup, ToggleGroupItem } from "@/components/ui/toggle-group";
import { cn } from "@/lib/utils";
const EXPORT_WIDTH = 1200;
@@ -89,55 +89,70 @@ export function GuideImageExport({
const capturing = captureMode !== null;
const [storedLanguage, setStoredLanguage] = useExportLanguage();
const language = controlledLanguage ?? storedLanguage;
- const [pendingCaptureMode, setPendingCaptureMode] = useState<
- "with-notes" | "without-notes" | null
- >(null);
+ const [selectedMode, setSelectedMode] = useState<"with-notes" | "without-notes">(
+ "with-notes",
+ );
const [modeDialogOpen, setModeDialogOpen] = useState(false);
- function requestCapture(mode: "with-notes" | "without-notes") {
+ function requestCapture() {
setModeDialogOpen(false);
- if (promptForLanguage) setPendingCaptureMode(mode);
- else setCaptureMode(mode);
+ setCaptureMode(selectedMode);
}
- function selectLanguage(nextLanguage: ExportLanguage) {
- if (!pendingCaptureMode) return;
- setStoredLanguage(nextLanguage);
- setCaptureMode(pendingCaptureMode);
- setPendingCaptureMode(null);
- }
-
- function exportButton(
- mode: "with-notes" | "without-notes" | null,
- label: string,
- ) {
- const loading = capturing && (mode === null || captureMode === mode);
+ function exportButton(label: string) {
return (
);
}
+ const exportSettings = (
+ <>
+ {showLanguageSelector || promptForLanguage ? (
+
+ ) : null}
+ {allowWithoutNotes ? (
+
+
โน้ต
+
{
+ const next = values[0];
+ if (next === "with-notes" || next === "without-notes") setSelectedMode(next);
+ }}
+ >
+ รวมโน้ต
+ ไม่รวมโน้ต
+
+
+ ) : null}
+
+ >
+ );
+
useEffect(() => {
if (!capturing) return;
@@ -204,52 +219,22 @@ export function GuideImageExport({
return (
<>
- {showLanguageSelector ? (
-
- ) : null}
-
- {allowWithoutNotes && modeSelection === "inline"
- ? [
- exportButton("with-notes", buttonLabel),
- exportButton("without-notes", "ส่งออกภาพโดยไม่รวมโน้ต"),
- ]
- : exportButton(null, buttonLabel)}
-
- {allowWithoutNotes && modeSelection === "dialog" ? (
+ {modeSelection === "inline" ? (
+ exportSettings
+ ) : (
+
{exportButton(buttonLabel)}
+ )}
+ {modeSelection === "dialog" ? (
) : null}
-
{
- if (!open) setPendingCaptureMode(null);
- }}
- onSelect={selectLanguage}
- />
{capturing
? createPortal(
group.rows.some((row) => row[metric] !== null),
);
+ const [metric, setMetric] = useState
(
+ metricOptions[0]?.[0] ?? "overallPercent",
+ );
+ const metricLabel = metric === "overallPercent" ? "Overall Damage" : "Personal Damage";
return (