diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index e27a172..5c24151 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -274,6 +274,9 @@ importers: cn: specifier: ^0.5.2 version: 0.5.2 + fflate: + specifier: ^0.8.3 + version: 0.8.3 highlight.js: specifier: ^11.12.0 version: 11.12.0 diff --git a/web/package.json b/web/package.json index 9435665..1f7ea79 100644 --- a/web/package.json +++ b/web/package.json @@ -38,6 +38,7 @@ "@tiptap/starter-kit": "^3.0.0", "class-variance-authority": "^0.7.1", "cn": "^0.5.2", + "fflate": "^0.8.3", "highlight.js": "^11.12.0", "i18next": "^27.1.1", "lowlight": "^3.3.0", diff --git a/web/src/components/CreateSpaceDialog.tsx b/web/src/components/CreateSpaceDialog.tsx index d6f71fd..6c042ea 100644 --- a/web/src/components/CreateSpaceDialog.tsx +++ b/web/src/components/CreateSpaceDialog.tsx @@ -1,3 +1,4 @@ +import { Upload } from "lucide-react" import { useEffect, useState } from "react" import { useTranslation } from "react-i18next" import { useNavigate } from "react-router" @@ -14,6 +15,7 @@ import { Input } from "@/components/ui/input" import { Label } from "@/components/ui/label" import { Textarea } from "@/components/ui/textarea" import { ApiError, describeApiError, type Space } from "@/lib/api" +import { ImportSpaceDialog } from "@/components/ImportSpaceDialog" import { isValidSpaceSlug, spaceSlugCandidate } from "@/lib/space" import { useSpacesStore } from "@/stores/spaces" @@ -45,6 +47,7 @@ export function CreateSpaceDialog({ const [busy, setBusy] = useState(false) const [createError, setCreateError] = useState("") const [slugError, setSlugError] = useState("") + const [importOpen, setImportOpen] = useState(false) useEffect(() => { if (open) { @@ -123,97 +126,122 @@ export function CreateSpaceDialog({ } return ( - - - - {t("shell.spaces.new")} - {t("shell.spaces.create.hint")} - -
{ - event.preventDefault() - void submitCreate() - }} - > -
- - handleNameChange(event.target.value)} - placeholder={t("shell.spaces.create.namePlaceholder")} - /> -
-
- -
- + <> + + + + {t("shell.spaces.new")} + + {t("shell.spaces.create.hint")} + + + { + event.preventDefault() + void submitCreate() + }} + > +
+ handleSlugChange(event.target.value)} - autoCapitalize="none" - autoComplete="off" - spellCheck={false} - className="pl-8 font-mono" - aria-invalid={Boolean(slugError)} + id="new-space-name" + name="space-name" + autoFocus + maxLength={64} + value={name} + onChange={(event) => handleNameChange(event.target.value)} + placeholder={t("shell.spaces.create.namePlaceholder")} />
- {slugError ? ( +
+ +
+ + handleSlugChange(event.target.value)} + autoCapitalize="none" + autoComplete="off" + spellCheck={false} + className="pl-8 font-mono" + aria-invalid={Boolean(slugError)} + /> +
+ {slugError ? ( +

+ {slugError} +

+ ) : null} +
+
+ +