Skip to content

armgit / memos

Public Imported from GitHub
0

Memos is an open-source, self-hosted note-taking app that brings your everyday thoughts together in a personal timeline. Your data stays yours, and you choose what to keep private or share.

feat(editor): add Space selection to memo visibility setting

johnnyjoygh594ccd02c5f2
diff --git a/web/src/components/AppSidebar/SpaceSwitcher.tsx b/web/src/components/AppSidebar/SpaceSwitcher.tsx
index d797530ab..16b18dd93 100644
--- a/web/src/components/AppSidebar/SpaceSwitcher.tsx
+++ b/web/src/components/AppSidebar/SpaceSwitcher.tsx
@@ -13,6 +13,7 @@ import { Link, useLocation, useNavigate } from "react-router-dom";
import CreateSpaceDialog from "@/components/CreateSpaceDialog";
import MemosLogo from "@/components/MemosLogo";
import SpaceMark from "@/components/SpaceMark";
+import SpaceSelectItem from "@/components/SpaceSelectItem";
import UserAvatar from "@/components/UserAvatar";
import UserMenu from "@/components/UserMenu";
import { Button } from "@/components/ui/button";
@@ -215,7 +216,11 @@ function SpaceSwitcher({ className, size = "md" }: { className?: string; size?:
if (value !== null) navigate(getSpaceSwitchPath(location, value === "all" ? undefined : value));
}}
>
- <SelectTrigger aria-label={t("space.switch")} className="h-8 w-full px-2 text-xs font-medium shadow-none">
+ <SelectTrigger
+ aria-label={t("space.switch")}
+ title={selectedSpaceName ? spaceLabel : allSpacesLabel}
+ className="h-8 w-full px-2 text-xs font-medium shadow-none"
+ >
{selectedSpaceName ? (
<SpaceMark icon={selectedSpace?.icon} size="sm" />
) : (
@@ -223,7 +228,7 @@ function SpaceSwitcher({ className, size = "md" }: { className?: string; size?:
)}
<span className="min-w-0 flex-1 truncate text-start">{selectedSpaceName ? spaceLabel : allSpacesLabel}</span>
</SelectTrigger>
- <SelectContent className="max-h-64" align="start">
+ <SelectContent className="max-h-64 w-(--anchor-width) min-w-0 max-w-[calc(100vw-2rem)]" align="start">
<SelectItem value="all">
<span className="flex items-center gap-2">
<AstroidIcon className="size-4" />
@@ -233,15 +238,12 @@ function SpaceSwitcher({ className, size = "md" }: { className?: string; size?:
{spaces.map((space) => {
const uid = extractSpaceUidFromName(space.name);
return (
- <SelectItem key={space.name} value={space.name}>
- <span className="flex items-center gap-2">
- <SpaceMark icon={space.icon} size="sm" />
- <span className="truncate">
- {space.title}
- {duplicateSpaceTitles.has(space.title) ? ` (${uid})` : ""}
- </span>
- </span>
- </SelectItem>
+ <SpaceSelectItem
+ key={space.name}
+ value={space.name}
+ label={duplicateSpaceTitles.has(space.title) ? `${space.title} (${uid})` : space.title}
+ icon={space.icon}
+ />
);
})}
{isLoadingSpaces && (
diff --git a/web/src/components/MemoActionMenu/MemoMoveDialog.tsx b/web/src/components/MemoActionMenu/MemoMoveDialog.tsx
index caa4f7ab6..1a8877be5 100644
--- a/web/src/components/MemoActionMenu/MemoMoveDialog.tsx
+++ b/web/src/components/MemoActionMenu/MemoMoveDialog.tsx
@@ -1,5 +1,7 @@
import { type FormEvent, useState } from "react";
import { toast } from "react-hot-toast";
+import SpaceMark from "@/components/SpaceMark";
+import SpaceSelectItem from "@/components/SpaceSelectItem";
import { Button } from "@/components/ui/button";
import { Dialog, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogTitle } from "@/components/ui/dialog";
import { Label } from "@/components/ui/label";
@@ -79,15 +81,16 @@ export default function MemoMoveDialog({ memo, onOpenChange }: { memo: Memo; onO
if (value === UNASSIGNED && visibility === Visibility.SPACE) setVisibility(Visibility.PRIVATE);
}}
>
- <SelectTrigger id="memo-destination" className="w-full">
- <SelectValue>{destinationLabel}</SelectValue>
+ <SelectTrigger id="memo-destination" className="w-full min-w-0" title={destinationLabel}>
+ <SelectValue className="min-w-0 flex-1">
+ {nextSpace && <SpaceMark icon={selectedSpace?.icon} size="sm" />}
+ <span className="truncate">{destinationLabel}</span>
+ </SelectValue>
</SelectTrigger>
- <SelectContent>
+ <SelectContent className="w-(--anchor-width) min-w-0 max-w-[calc(100vw-2rem)]">
<SelectItem value={UNASSIGNED}>{t("memo.move.unassigned")}</SelectItem>
{spaces.map((space) => (
- <SelectItem key={space.name} value={space.name}>
- {spaceLabel(space)}
- </SelectItem>
+ <SpaceSelectItem key={space.name} value={space.name} label={spaceLabel(space)} icon={space.icon} />
))}
</SelectContent>
</Select>
diff --git a/web/src/components/MemoEditor/README.md b/web/src/components/MemoEditor/README.md
index 300e01e8e..30a23a60a 100644
--- a/web/src/components/MemoEditor/README.md
+++ b/web/src/components/MemoEditor/README.md
@@ -56,7 +56,7 @@ MemoEditor/
│ └── ... # Heading/list/viewport decorations, editor.css
├── formatting/
│ └── commands.ts # Backend-agnostic catalog of formatting verbs
-├── Toolbar/ # EditorToolbar, FormattingToolbar, InsertMenu, VisibilitySelector
+├── Toolbar/ # EditorToolbar, FormattingToolbar, InsertMenu, MemoSettings
├── constants.ts
└── types/ # EditorController / FormattingController, component props,
# attachment and insert-menu types
@@ -138,6 +138,10 @@ Every instance is one of two things, and `onFocusModeExit` is the switch:
Those toggles travel as a single optional `viewToggles` object (`types/components.ts`) down `EditorToolbar` → `InsertMenu`, so they can only appear or disappear together.
+### Destination and visibility
+
+`MemoSettings` combines visibility with a compact Space select for new top-level memos created outside a Space. A host-provided `defaultSpace` fixes placement and hides the select; edits and comments also omit it. The selected destination lives in editor metadata and is sent on creation. Clearing a Space-only audience resets it to Private. Drafts retain destination and visibility alongside content, attachments, and location. Long names are truncated in the toolbar, select, and options, with their full text retained for accessible labels and hover titles.
+
### Lifecycle hooks
Cross-cutting React workflows stay outside the editor shell. `useMemoSave`
diff --git a/web/src/components/MemoEditor/Toolbar/EditorToolbar.tsx b/web/src/components/MemoEditor/Toolbar/EditorToolbar.tsx
index d91af936c..8c0fefae4 100644
--- a/web/src/components/MemoEditor/Toolbar/EditorToolbar.tsx
+++ b/web/src/components/MemoEditor/Toolbar/EditorToolbar.tsx
@@ -3,14 +3,14 @@ import type { FC } from "react";
import { Button } from "@/components/ui/button";
import { Tooltip, TooltipContent, TooltipTrigger } from "@/components/ui/tooltip";
import { cn } from "@/lib/utils";
-import type { Location, Visibility } from "@/types/proto/api/v1/memo_service_pb";
+import { type Location, Visibility } from "@/types/proto/api/v1/memo_service_pb";
import { useTranslate } from "@/utils/i18n";
import { primaryModifierGlyph } from "@/utils/platform";
import { validationService } from "../services";
import { useEditorContext, useEditorSelector } from "../state";
import type { EditorToolbarProps } from "../types";
import InsertMenu from "./InsertMenu";
-import VisibilitySelector from "./VisibilitySelector";
+import MemoSettings from "./MemoSettings";
/**
* Shortcut chip inside the commit button. While saving, a spinner takes the
@@ -36,6 +36,7 @@ export const EditorToolbar: FC<EditorToolbarProps> = ({
memoName,
parentMemoName,
space,
+ canChooseSpace,
onAudioRecorderClick,
viewToggles,
onInsertImages,
@@ -75,6 +76,10 @@ export const EditorToolbar: FC<EditorToolbarProps> = ({
dispatch(actions.setMetadata({ visibility: next }));
};
+ const handleSpaceChange = (next?: string) => {
+ dispatch(actions.setMetadata({ space: next, ...(!next && visibility === Visibility.SPACE ? { visibility: Visibility.PRIVATE } : {}) }));
+ };
+
const commitButton = justSaved ? (
<Button size="sm" disabled>
{t("editor.saved")}
@@ -89,8 +94,8 @@ export const EditorToolbar: FC<EditorToolbarProps> = ({
return (
// Every control on this rail is 28px, the same box as the sidebar's compose control and nav pills.
- <div className="flex w-full flex-row items-center justify-between">
- <div className="flex flex-row items-center justify-start gap-1">
+ <div className="flex w-full min-w-0 flex-row items-center justify-between gap-1">
+ <div className="flex min-w-0 flex-1 flex-row items-center justify-start gap-1">
<InsertMenu
isUploading={isUploading}
isSaving={committing}
@@ -101,10 +106,16 @@ export const EditorToolbar: FC<EditorToolbarProps> = ({
viewToggles={viewToggles}
onInsertImages={onInsertImages}
/>
- <VisibilitySelector value={visibility} space={space} onChange={handleVisibilityChange} />
+ <MemoSettings
+ value={visibility}
+ space={space}
+ onChange={handleVisibilityChange}
+ onSpaceChange={canChooseSpace ? handleSpaceChange : undefined}
+ disabled={committing}
+ />
</div>
- <div className="flex flex-row items-center justify-end gap-1">
+ <div className="flex shrink-0 flex-row items-center justify-end gap-1">
{onCancel && (
<Button variant="quiet" size="sm" onClick={onCancel} disabled={committing}>
{t("common.cancel")}
diff --git a/web/src/components/MemoEditor/Toolbar/MemoSettings.tsx b/web/src/components/MemoEditor/Toolbar/MemoSettings.tsx
new file mode 100644
index 000000000..3e2a521ab
--- /dev/null
+++ b/web/src/components/MemoEditor/Toolbar/MemoSettings.tsx
@@ -0,0 +1,158 @@
+import { Radio } from "@base-ui/react/radio";
+import { CheckIcon, ChevronDownIcon } from "lucide-react";
+import { useId, useState } from "react";
+import SpaceIcon from "@/components/SpaceIcon";
+import SpaceMark from "@/components/SpaceMark";
+import SpaceSelectItem from "@/components/SpaceSelectItem";
+import { Button } from "@/components/ui/button";
+import { Popover, PopoverContent, PopoverTrigger } from "@/components/ui/popover";
+import { RadioGroup } from "@/components/ui/radio-group";
+import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from "@/components/ui/select";
+import VisibilityIcon from "@/components/VisibilityIcon";
+import useCurrentUser from "@/hooks/useCurrentUser";
+import { useSpaces } from "@/hooks/useSpaceQueries";
+import { extractSpaceUidFromName, getDuplicateSpaceTitles } from "@/lib/space-display";
+import type { Visibility } from "@/types/proto/api/v1/memo_service_pb";
+import { useTranslate } from "@/utils/i18n";
+import { getAssignableVisibilityOptions, getVisibilityOption } from "@/utils/memo";
+import type { MemoSettingsProps } from "../types";
+
+const NO_SPACE = "no-space";
+
+/** One quiet control for audience and, in an unscoped new composer, destination. */
+const MemoSettings = ({ value, onChange, space, onSpaceChange, disabled }: MemoSettingsProps) => {
+ const t = useTranslate();
+ const user = useCurrentUser();
+ const { data: spaces = [], isPending, isError, refetch } = useSpaces(user?.name, { enabled: Boolean(onSpaceChange) });
+ const [open, setOpen] = useState(false);
+ const spaceId = useId();
+ const visibilityOptions = getAssignableVisibilityOptions({ hasSpacePlacement: Boolean(space), current: value });
+ const currentOption = getVisibilityOption(value);
+ const visibilityLabel = currentOption ? t(currentOption.labelKey) : "";
+ const duplicates = getDuplicateSpaceTitles(spaces);
+ const spaceLabel = (item: (typeof spaces)[number]) =>
+ duplicates.has(item.title) ? `${item.title} (${extractSpaceUidFromName(item.name)})` : item.title;
+ const selectedSpace = spaces.find((item) => item.name === space);
+ const destination = space ? (selectedSpace ? spaceLabel(selectedSpace) : extractSpaceUidFromName(space)) : t("space.no-space");
+ const summary = onSpaceChange && space ? `${destination} · ${visibilityLabel}` : visibilityLabel;
+
+ return (
+ <Popover open={open} onOpenChange={setOpen}>
+ <PopoverTrigger
+ render={<Button variant="quiet" size="sm" className="min-w-0 max-w-64 shrink gap-1 text-muted-foreground" disabled={disabled} />}
+ title={summary}
+ aria-label={summary}
+ >
+ {onSpaceChange && space && (
+ <>
+ <span className="flex min-w-0 max-w-32 items-center gap-1 sm:max-w-40">
+ <SpaceIcon icon={selectedSpace?.icon} />
+ <span className="truncate">{destination}</span>
+ </span>
+ <span aria-hidden className="shrink-0 opacity-40">
+ ·
+ </span>
+ </>
+ )}
+ <span className="flex shrink-0 items-center gap-1">
+ <VisibilityIcon visibility={value} className="text-current" />
+ <span>{visibilityLabel}</span>
+ </span>
+ <ChevronDownIcon className="size-3 opacity-50" strokeWidth={1.8} />
+ </PopoverTrigger>
+ <PopoverContent align="start" className="w-64 max-w-[calc(100vw-2rem)] p-1" aria-label={t("common.visibility")}>
+ {onSpaceChange && <div className="px-2 py-1 text-xs text-muted-foreground">{t("common.visibility")}</div>}
+ <RadioGroup
+ value={value}
+ onValueChange={(next) => {
+ onChange(next as Visibility);
+ setOpen(false);
+ }}
+ disabled={disabled}
+ aria-label={t("common.visibility")}
+ className="gap-0"
+ >
+ {visibilityOptions.map((option) => (
+ <Radio.Root
+ key={option.value}
+ value={option.value}
+ className="flex w-full min-w-0 cursor-pointer items-center gap-2 rounded-sm px-2 py-1 text-start text-ui outline-none hover:bg-accent focus-visible:bg-accent disabled:opacity-50"
+ >
+ <VisibilityIcon visibility={option.value} className="size-3.5 shrink-0" />
+ <span className="min-w-0 flex-1">
+ <span className="block">{t(option.labelKey)}</span>
+ <span className="block text-2xs text-muted-foreground">{t(option.descriptionKey)}</span>
+ </span>
+ <span className="size-3.5 shrink-0">
+ <Radio.Indicator>
+ <CheckIcon className="size-3.5 text-primary" />
+ </Radio.Indicator>
+ </span>
+ </Radio.Root>
+ ))}
+ </RadioGroup>
+ {onSpaceChange && (
+ <div className="mt-1 grid min-w-0 gap-1.5 border-t px-2 pt-2 pb-1">
+ <label id={spaceId} className="text-xs text-muted-foreground" htmlFor={`${spaceId}-select`}>
+ {t("space.current")}
+ </label>
+ <Select
+ value={space || NO_SPACE}
+ onValueChange={(next) => onSpaceChange(next === NO_SPACE ? undefined : next)}
+ disabled={disabled}
+ >
+ <SelectTrigger
+ id={`${spaceId}-select`}
+ size="sm"
+ className="w-full min-w-0 text-ui"
+ aria-labelledby={spaceId}
+ title={destination}
+ >
+ <SelectValue className="min-w-0 flex-1">
+ {space && <SpaceMark icon={selectedSpace?.icon} size="sm" />}
+ <span className="truncate">{destination}</span>
+ </SelectValue>
+ </SelectTrigger>
+ <SelectContent className="max-h-[min(16rem,var(--available-height))] w-(--anchor-width) min-w-0 max-w-[calc(100vw-2rem)]">
+ <SelectItem value={NO_SPACE} className="text-ui">
+ {t("space.no-space")}
+ </SelectItem>
+ {space && !selectedSpace && (
+ <SelectItem
+ value={space}
+ disabled
+ className="[&>div:first-child]:min-w-0 [&>div:first-child]:flex-1 [&>div:first-child]:truncate"
+ title={destination}
+ >
+ <span className="flex min-w-0 items-center gap-2">
+ <SpaceMark size="sm" />
+ <span className="truncate">{destination}</span>
+ </span>
+ </SelectItem>
+ )}
+ {spaces.map((item) => (
+ <SpaceSelectItem key={item.name} value={item.name} label={spaceLabel(item)} icon={item.icon} className="text-ui" />
+ ))}
+ </SelectContent>
+ </Select>
+ {isPending && (
+ <p role="status" className="text-xs text-muted-foreground">
+ {t("space.loading")}
+ </p>
+ )}
+ {isError && (
+ <p role="alert" className="text-xs text-destructive">
+ {t("space.load-error")}{" "}
+ <button type="button" className="underline" onClick={() => void refetch()}>
+ {t("search.retry")}
+ </button>
+ </p>
+ )}
+ </div>
+ )}
+ </PopoverContent>
+ </Popover>
+ );
+};
+
+export default MemoSettings;
diff --git a/web/src/components/MemoEditor/Toolbar/VisibilitySelector.tsx b/web/src/components/MemoEditor/Toolbar/VisibilitySelector.tsx
deleted file mode 100644
index 24725a5b5..000000000
--- a/web/src/components/MemoEditor/Toolbar/VisibilitySelector.tsx
+++ /dev/null
@@ -1,47 +0,0 @@
-import { CheckIcon, ChevronDownIcon } from "lucide-react";
-import { Button } from "@/components/ui/button";
-import { DropdownMenu, DropdownMenuContent, DropdownMenuItem, DropdownMenuTrigger } from "@/components/ui/dropdown-menu";
-import VisibilityIcon from "@/components/VisibilityIcon";
-import { cn } from "@/lib/utils";
-import { useTranslate } from "@/utils/i18n";
-import { getAssignableVisibilityOptions, getVisibilityOption } from "@/utils/memo";
-import type { VisibilitySelectorProps } from "../types";
-
-/**
- * The visibility control is a quiet 28px chip built like the sidebar's scope pill: a
- * 16px glyph at 75%, a 13px label and a 12px chevron at 55%. It fills only while its
- * menu is open.
- */
-const VisibilitySelector = (props: VisibilitySelectorProps) => {
- const { value, onChange } = props;
- const t = useTranslate();
-
- const visibilityOptions = getAssignableVisibilityOptions({ hasSpacePlacement: Boolean(props.space), current: value });
- // Resolved from the full catalog, so the trigger names the memo's audience even
- // when that audience is not currently on offer.
- const currentOption = getVisibilityOption(value);
-
- return (
- <DropdownMenu onOpenChange={props.onOpenChange}>
- <DropdownMenuTrigger render={<Button variant="quiet" size="sm" />}>
- <VisibilityIcon visibility={value} className="text-current opacity-75" />
- <span className="truncate">{currentOption ? t(currentOption.labelKey) : ""}</span>
- <ChevronDownIcon className="size-3 opacity-55" strokeWidth={1.8} />
- </DropdownMenuTrigger>
- <DropdownMenuContent align="start" size="sm">
- {visibilityOptions.map((option) => (
- <DropdownMenuItem key={option.value} onClick={() => onChange(option.value)}>
- <VisibilityIcon visibility={option.value} className="size-3.5" />
- <div className="flex flex-col">
- <span>{t(option.labelKey)}</span>
- <span className="text-2xs text-muted-foreground">{t(option.descriptionKey)}</span>
- </div>
- <CheckIcon className={cn("ms-auto size-3.5 text-primary", value !== option.value && "invisible")} />
- </DropdownMenuItem>
- ))}
- </DropdownMenuContent>
- </DropdownMenu>
- );
-};
-
-export default VisibilitySelector;
diff --git a/web/src/components/MemoEditor/Toolbar/index.ts b/web/src/components/MemoEditor/Toolbar/index.ts
index 676ca4021..dd60f3b9a 100644
--- a/web/src/components/MemoEditor/Toolbar/index.ts
+++ b/web/src/components/MemoEditor/Toolbar/index.ts
@@ -2,4 +2,4 @@
export { EditorToolbar } from "./EditorToolbar";
export { FormattingToolbar } from "./FormattingToolbar";
export { default as InsertMenu } from "./InsertMenu";
-export { default as VisibilitySelector } from "./VisibilitySelector";
+export { default as MemoSettings } from "./MemoSettings";
diff --git a/web/src/components/MemoEditor/hooks/useAutoSave.ts b/web/src/components/MemoEditor/hooks/useAutoSave.ts
index 873296228..87b87759a 100644
--- a/web/src/components/MemoEditor/hooks/useAutoSave.ts
+++ b/web/src/components/MemoEditor/hooks/useAutoSave.ts
@@ -3,10 +3,20 @@ import { useCallback, useEffect, useRef } from "react";
import { AttachmentSchema } from "@/types/proto/api/v1/attachment_service_pb";
import { LocationSchema } from "@/types/proto/api/v1/memo_service_pb";
import { cacheService, type EditorDraft } from "../services";
-import { useEditorStore } from "../state";
+import { type EditorState, useEditorStore } from "../state";
+
+const draftFromState = ({ content, metadata }: EditorState): EditorDraft => ({
+ content,
+ attachments: metadata.attachments,
+ location: metadata.location ?? null,
+ space: metadata.space,
+ visibility: metadata.visibility,
+});
const sameDraft = (left: EditorDraft, right: EditorDraft): boolean =>
left.content === right.content &&
+ left.space === right.space &&
+ left.visibility === right.visibility &&
(left.location === right.location || (!!left.location && !!right.location && equals(LocationSchema, left.location, right.location))) &&
left.attachments.length === right.attachments.length &&
left.attachments.every((attachment, index) => {
@@ -22,12 +32,7 @@ const sameDraft = (left: EditorDraft, right: EditorDraft): boolean =>
*/
export const useAutoSave = (username: string, cacheKey: string | undefined, enabled = true) => {
const store = useEditorStore();
- const initialState = store.getState();
- const latestDraftRef = useRef<EditorDraft>({
- content: initialState.content,
- attachments: initialState.metadata.attachments,
- location: initialState.metadata.location ?? null,
- });
+ const latestDraftRef = useRef<EditorDraft>(draftFromState(store.getState()));
const discardedDraftRef = useRef<EditorDraft | undefined>(undefined);
useEffect(() => {
@@ -39,19 +44,13 @@ export const useAutoSave = (username: string, cacheKey: string | undefined, enab
if (discardedDraftRef.current !== undefined && !sameDraft(discardedDraftRef.current, draft)) {
discardedDraftRef.current = undefined;
}
- cacheService.save(key, draft.content, draft.attachments, draft.location);
+ cacheService.save(key, draft);
};
// Persist the current draft on mount/enable, then on every relevant change.
- const state = store.getState();
- persist({ content: state.content, attachments: state.metadata.attachments, location: state.metadata.location ?? null });
+ persist(draftFromState(store.getState()));
return store.subscribe(() => {
- const nextState = store.getState();
- const draft = {
- content: nextState.content,
- attachments: nextState.metadata.attachments,
- location: nextState.metadata.location ?? null,
- };
+ const draft = draftFromState(store.getState());
if (!sameDraft(draft, latestDraftRef.current)) {
persist(draft);
}
@@ -67,7 +66,7 @@ export const useAutoSave = (username: string, cacheKey: string | undefined, enab
return;
}
- cacheService.saveNow(key, latestDraftRef.current.content, latestDraftRef.current.attachments, latestDraftRef.current.location);
+ cacheService.saveNow(key, latestDraftRef.current);
};
const handleVisibilityChange = () => {
if (document.visibilityState === "hidden") {
diff --git a/web/src/components/MemoEditor/hooks/useMemoInit.ts b/web/src/components/MemoEditor/hooks/useMemoInit.ts
index 83a1b501a..6c185c63e 100644
--- a/web/src/components/MemoEditor/hooks/useMemoInit.ts
+++ b/web/src/components/MemoEditor/hooks/useMemoInit.ts
@@ -13,6 +13,7 @@ interface UseMemoInitOptions {
defaultVisibility?: Visibility;
defaultCreateTime?: Date;
defaultLocation?: Location;
+ canChooseSpace?: boolean;
}
export const useMemoInit = ({
@@ -24,6 +25,7 @@ export const useMemoInit = ({
defaultVisibility,
defaultCreateTime,
defaultLocation,
+ canChooseSpace = false,
}: UseMemoInitOptions) => {
const { actions, dispatch } = useEditorContext();
const initializedRef = useRef(false);
@@ -47,8 +49,12 @@ export const useMemoInit = ({
dispatch(actions.setMetadata({ attachments: cachedDraft.attachments }));
}
dispatch(actions.setMetadata({ location: cachedDraft.location === null ? undefined : (cachedDraft.location ?? defaultLocation) }));
- if (defaultVisibility !== undefined) {
- dispatch(actions.setMetadata({ visibility: defaultVisibility }));
+ const visibility = cachedDraft.visibility ?? defaultVisibility;
+ if (visibility !== undefined) {
+ dispatch(actions.setMetadata({ visibility }));
+ }
+ if (canChooseSpace) {
+ dispatch(actions.setMetadata({ space: cachedDraft.space }));
}
if (defaultCreateTime) {
dispatch(actions.setTimestamps({ createTime: defaultCreateTime, updateTime: defaultCreateTime }));
@@ -74,7 +80,19 @@ export const useMemoInit = ({
clearTimeout(restoreCursorTimer);
}
};
- }, [memo, cacheKey, username, autoFocus, defaultVisibility, defaultCreateTime, defaultLocation, actions, dispatch, editorRef]);
+ }, [
+ memo,
+ cacheKey,
+ username,
+ autoFocus,
+ defaultVisibility,
+ defaultCreateTime,
+ defaultLocation,
+ canChooseSpace,
+ actions,
+ dispatch,
+ editorRef,
+ ]);
return { isInitialized };
};
diff --git a/web/src/components/MemoEditor/index.tsx b/web/src/components/MemoEditor/index.tsx
index c1a07489e..978d49804 100644
--- a/web/src/components/MemoEditor/index.tsx
+++ b/web/src/components/MemoEditor/index.tsx
@@ -84,7 +84,9 @@ const MemoEditorImpl: React.FC<MemoEditorProps> = ({
const memoName = memo?.name;
// Existing resources own their placement. New replies are not placed
// independently; only a new top-level memo inherits its host's target.
- const editorSpace = memo ? memo.space : parentMemoName ? undefined : defaultSpace;
+ const draftSpace = useEditorSelector((s) => s.metadata.space);
+ const canChooseSpace = !memo && !parentMemoName && !defaultSpace;
+ const editorSpace = memo ? memo.space : parentMemoName ? undefined : (defaultSpace ?? draftSpace);
const canTranscribe = useMemo(() => {
const providerId = aiSetting.transcription?.providerId ?? "";
if (!providerId) return false;
@@ -105,6 +107,7 @@ const MemoEditorImpl: React.FC<MemoEditorProps> = ({
defaultVisibility,
defaultCreateTime,
defaultLocation,
+ canChooseSpace,
});
const isDraftCacheEnabled = !memo;
@@ -411,6 +414,7 @@ const MemoEditorImpl: React.FC<MemoEditorProps> = ({
memoName={memoName}
parentMemoName={parentMemoName}
space={editorSpace}
+ canChooseSpace={canChooseSpace}
onAudioRecorderClick={handleAudioRecorderClick}
viewToggles={viewToggles}
onInsertImages={handleInsertImages}
diff --git a/web/src/components/MemoEditor/services/cacheService.ts b/web/src/components/MemoEditor/services/cacheService.ts
index f6f2c69b5..ba6ca8d85 100644
--- a/web/src/components/MemoEditor/services/cacheService.ts
+++ b/web/src/components/MemoEditor/services/cacheService.ts
@@ -2,7 +2,7 @@ import { fromJson, type JsonValue, toJson } from "@bufbuild/protobuf";
import type { Attachment } from "@/types/proto/api/v1/attachment_service_pb";
import { AttachmentSchema } from "@/types/proto/api/v1/attachment_service_pb";
-import { type Location, LocationSchema } from "@/types/proto/api/v1/memo_service_pb";
+import { type Location, LocationSchema, Visibility } from "@/types/proto/api/v1/memo_service_pb";
export const CACHE_DEBOUNCE_DELAY = 500;
@@ -14,13 +14,23 @@ const STRUCTURED_CACHE_ENTRY_VERSION = 3;
export interface EditorDraft {
content: string;
attachments: Attachment[];
+ space?: string;
+ visibility?: Visibility;
/** Undefined for legacy drafts; null explicitly remembers a removed location. */
location?: Location | null;
}
function deserializeDraft(raw: string): EditorDraft {
try {
- const parsed = JSON.parse(raw) as { kind?: unknown; version?: unknown; content?: unknown; attachments?: unknown; location?: unknown };
+ const parsed = JSON.parse(raw) as {
+ kind?: unknown;
+ version?: unknown;
+ content?: unknown;
+ attachments?: unknown;
+ location?: unknown;
+ space?: unknown;
+ visibility?: unknown;
+ };
if (parsed.kind === STRUCTURED_CACHE_ENTRY_KIND && parsed.version === 1 && typeof parsed.content === "string") {
return { content: parsed.content, attachments: [] };
}
@@ -49,7 +59,13 @@ function deserializeDraft(raw: string): EditorDraft {
}
}
}
- return { content: parsed.content, attachments, ...(location !== undefined ? { location } : {}) };
+ const space = typeof parsed.space === "string" && parsed.space.startsWith("spaces/") ? parsed.space : undefined;
+ const visibility = [Visibility.PRIVATE, Visibility.PROTECTED, Visibility.PUBLIC, Visibility.SPACE].includes(
+ parsed.visibility as Visibility,
+ )
+ ? (parsed.visibility as Visibility)
+ : undefined;
+ return { content: parsed.content, attachments, ...(location !== undefined ? { location } : {}), space, visibility };
}
} catch {
// Drafts have historically been stored as raw markdown strings.
@@ -58,19 +74,21 @@ function deserializeDraft(raw: string): EditorDraft {
return { content: raw, attachments: [] };
}
-function serializeDraft(content: string, attachments: Attachment[], location: Location | null): string {
+function serializeDraft({ content, attachments, location, space, visibility }: EditorDraft): string {
return JSON.stringify({
kind: STRUCTURED_CACHE_ENTRY_KIND,
version: STRUCTURED_CACHE_ENTRY_VERSION,
location: location ? toJson(LocationSchema, location) : null,
+ space,
+ visibility,
content,
attachments: attachments.map((attachment) => toJson(AttachmentSchema, attachment)),
});
}
-function writeEntry(key: string, content: string, attachments: Attachment[], location: Location | null): void {
- if (content.trim() || attachments.length > 0) {
- localStorage.setItem(key, serializeDraft(content, attachments, location));
+function writeEntry(key: string, draft: EditorDraft): void {
+ if (draft.content.trim() || draft.attachments.length > 0 || draft.space) {
+ localStorage.setItem(key, serializeDraft(draft));
} else {
localStorage.removeItem(key);
}
@@ -81,7 +99,7 @@ export const cacheService = {
return `${username}-${cacheKey || ""}`;
},
- save: (key: string, content: string, attachments: Attachment[] = [], location: Location | null = null) => {
+ save: (key: string, draft: EditorDraft) => {
const pendingSave = pendingSaves.get(key);
if (pendingSave) {
window.clearTimeout(pendingSave);
@@ -90,20 +108,20 @@ export const cacheService = {
const timeoutId = window.setTimeout(() => {
pendingSaves.delete(key);
- writeEntry(key, content, attachments, location);
+ writeEntry(key, draft);
}, CACHE_DEBOUNCE_DELAY);
pendingSaves.set(key, timeoutId);
},
- saveNow: (key: string, content: string, attachments: Attachment[] = [], location: Location | null = null) => {
+ saveNow: (key: string, draft: EditorDraft) => {
const pendingSave = pendingSaves.get(key);
if (pendingSave) {
window.clearTimeout(pendingSave);
pendingSaves.delete(key);
}
- writeEntry(key, content, attachments, location);
+ writeEntry(key, draft);
},
load(key: string): string {
diff --git a/web/src/components/MemoEditor/services/memoService.ts b/web/src/components/MemoEditor/services/memoService.ts
index 8ddfcb1ed..5da638b77 100644
--- a/web/src/components/MemoEditor/services/memoService.ts
+++ b/web/src/components/MemoEditor/services/memoService.ts
@@ -114,7 +114,7 @@ export const memoService = {
location: state.metadata.location,
createTime: state.timestamps.createTime ? timestampFromDate(state.timestamps.createTime) : undefined,
updateTime: state.timestamps.updateTime ? timestampFromDate(state.timestamps.updateTime) : undefined,
- space: options.parentMemoName ? undefined : options.space,
+ space: options.parentMemoName ? undefined : (options.space ?? state.metadata.space),
});
const memo = options.parentMemoName
diff --git a/web/src/components/MemoEditor/state/types.ts b/web/src/components/MemoEditor/state/types.ts
index 3146592ed..d0b3c0e85 100644
--- a/web/src/components/MemoEditor/state/types.ts
+++ b/web/src/components/MemoEditor/state/types.ts
@@ -11,6 +11,8 @@ export interface EditorState {
contentSource: ContentSource;
metadata: {
visibility: Visibility;
+ /** Destination chosen in an unscoped new-memo composer. */
+ space?: string;
attachments: Attachment[];
relations: MemoRelation[];
location?: Location;
diff --git a/web/src/components/MemoEditor/types/components.ts b/web/src/components/MemoEditor/types/components.ts
index a4619fb40..d65d1ac90 100644
--- a/web/src/components/MemoEditor/types/components.ts
+++ b/web/src/components/MemoEditor/types/components.ts
@@ -74,6 +74,8 @@ export interface EditorToolbarProps {
parentMemoName?: string;
/** The Space that owns the memo being created or edited, if any. */
space?: string;
+ /** Only unscoped, new top-level memos can choose a destination. */
+ canChooseSpace?: boolean;
onAudioRecorderClick: () => void;
viewToggles?: EditorViewToggles;
onInsertImages: (files: File[]) => void;
@@ -122,10 +124,11 @@ export interface InsertMenuProps {
onInsertImages: (files: File[]) => void;
}
-export interface VisibilitySelectorProps {
+export interface MemoSettingsProps {
value: Visibility;
onChange: (visibility: Visibility) => void;
/** The memo's actual placement; independent of the ambient collection scope. */
space?: string;
- onOpenChange?: (open: boolean) => void;
+ onSpaceChange?: (space?: string) => void;
+ disabled?: boolean;
}
diff --git a/web/src/components/MemoEditor/types/index.ts b/web/src/components/MemoEditor/types/index.ts
index adbdd0cf2..9b248c89a 100644
--- a/web/src/components/MemoEditor/types/index.ts
+++ b/web/src/components/MemoEditor/types/index.ts
@@ -10,7 +10,7 @@ export type {
FocusModeOverlayProps,
InsertMenuProps,
MemoEditorProps,
- VisibilitySelectorProps,
+ MemoSettingsProps,
} from "./components";
export type { EditorController } from "./editorController";
export type { LocationState } from "./insertMenu";
diff --git a/web/src/components/MemoView/components/MemoSpaceBadge.tsx b/web/src/components/MemoView/components/MemoSpaceBadge.tsx
index 3277bcd14..47f5e3966 100644
--- a/web/src/components/MemoView/components/MemoSpaceBadge.tsx
+++ b/web/src/components/MemoView/components/MemoSpaceBadge.tsx
@@ -34,7 +34,7 @@ const MemoSpaceBadge = ({ spaceName }: MemoSpaceBadgeProps) => {
showUid && uid ? "max-w-52 sm:max-w-64" : "max-w-36 sm:max-w-48",
)}
>
- <SpaceIcon icon={knownSpace?.icon} className="size-3 text-xs" />
+ <SpaceIcon icon={knownSpace?.icon} size={12} />
<span className="flex min-w-0 items-baseline overflow-hidden">
<span className="min-w-0 flex-1 truncate">
{knownTitle && <span className="sr-only">{spaceLabel}: </span>}
diff --git a/web/src/components/SpaceIcon.tsx b/web/src/components/SpaceIcon.tsx
index cc3f321a6..a3b40c154 100644
--- a/web/src/components/SpaceIcon.tsx
+++ b/web/src/components/SpaceIcon.tsx
@@ -1,6 +1,18 @@
import CustomIcon from "@/components/CustomIcon";
+import { cn } from "@/lib/utils";
import type { Space_Icon } from "@/types/proto/api/v1/space_service_pb";
-const SpaceIcon = ({ icon, className }: { icon?: Space_Icon; className?: string }) => <CustomIcon icon={icon} className={className} />;
+// Emoji need an explicit font size as well as a box, unlike SVG icons.
+const ICON_SIZE = {
+ 12: "size-3 text-xs",
+ 14: "size-3.5 text-sm",
+ 16: "size-4 text-base",
+ 20: "size-5 text-xl",
+ 24: "size-6 text-2xl",
+} as const;
+
+const SpaceIcon = ({ icon, size = 16, className }: { icon?: Space_Icon; size?: keyof typeof ICON_SIZE; className?: string }) => (
+ <CustomIcon icon={icon} className={cn(ICON_SIZE[size], className)} />
+);
export default SpaceIcon;
diff --git a/web/src/components/SpaceMark.tsx b/web/src/components/SpaceMark.tsx
index b02be847f..0fefc63f5 100644
--- a/web/src/components/SpaceMark.tsx
+++ b/web/src/components/SpaceMark.tsx
@@ -3,12 +3,12 @@ import { cn } from "@/lib/utils";
import type { Space_Icon } from "@/types/proto/api/v1/space_service_pb";
const MARK_SCALE = {
- xl: { mark: "size-11 rounded-lg", icon: "size-6", emoji: "text-2xl" },
- lg: { mark: "size-9 rounded-[7px]", icon: "size-5", emoji: "text-xl" },
- md: { mark: "size-7 rounded-[7px]", icon: "size-4", emoji: "text-base" },
+ xl: { mark: "size-11 rounded-lg", icon: 24, emoji: "text-2xl" },
+ lg: { mark: "size-9 rounded-[7px]", icon: 20, emoji: "text-xl" },
+ md: { mark: "size-7 rounded-[7px]", icon: 16, emoji: "text-base" },
/** Primary chrome: kept in step with MemosLogo's header scale. */
- header: { mark: "size-6 rounded-[6px]", icon: "size-3.5", emoji: "text-base" },
- sm: { mark: "size-5 rounded-[5px]", icon: "size-3", emoji: "text-sm" },
+ header: { mark: "size-6 rounded-[6px]", icon: 14, emoji: "text-base" },
+ sm: { mark: "size-5 rounded-[5px]", icon: 12, emoji: "text-sm" },
} as const;
interface Props {
@@ -17,6 +17,7 @@ interface Props {
className?: string;
}
+// Identity surfaces and Space selectors use a mark; inline references use SpaceIcon.
const SpaceMark = ({ icon, size = "md", className }: Props) => {
const scale = MARK_SCALE[size];
@@ -25,7 +26,7 @@ const SpaceMark = ({ icon, size = "md", className }: Props) => {
aria-hidden
className={cn("flex shrink-0 items-center justify-center bg-sidebar-accent text-sidebar-accent-foreground", scale.mark, className)}
>
- <SpaceIcon icon={icon} className={cn(scale.icon, icon?.value.case === "emoji" && scale.emoji)} />
+ <SpaceIcon icon={icon} size={scale.icon} className={cn(icon?.value.case === "emoji" && scale.emoji)} />
</span>
);
};
diff --git a/web/src/components/SpaceSelectItem.tsx b/web/src/components/SpaceSelectItem.tsx
new file mode 100644
index 000000000..225960906
--- /dev/null
+++ b/web/src/components/SpaceSelectItem.tsx
@@ -0,0 +1,26 @@
+import SpaceMark from "@/components/SpaceMark";
+import { SelectItem } from "@/components/ui/select";
+import { cn } from "@/lib/utils";
+import type { Space_Icon } from "@/types/proto/api/v1/space_service_pb";
+
+interface Props {
+ value: string;
+ label: string;
+ icon?: Space_Icon;
+ className?: string;
+}
+
+const SpaceSelectItem = ({ value, label, icon, className }: Props) => (
+ <SelectItem
+ value={value}
+ title={label}
+ className={cn("[&>div:first-child]:min-w-0 [&>div:first-child]:flex-1 [&>div:first-child]:shrink", className)}
+ >
+ <span className="flex min-w-0 items-center gap-2">
+ <SpaceMark icon={icon} size="sm" />
+ <span className="truncate">{label}</span>
+ </span>
+ </SelectItem>
+);
+
+export default SpaceSelectItem;
diff --git a/web/src/components/UserMenu.tsx b/web/src/components/UserMenu.tsx
index 502e118c0..665257b47 100644
--- a/web/src/components/UserMenu.tsx
+++ b/web/src/components/UserMenu.tsx
@@ -51,8 +51,10 @@ const PreferenceSubmenu = ({ icon: Icon, label, value, options, onChange, classN
<DropdownMenu>
<DropdownMenuTrigger openOnHover render={<Button variant="ghost" className={cn(rowClass, "data-popup-open:bg-accent")} />}>
<Icon className={iconClass} />
- <span className="min-w-0 flex-1 text-start">{label}</span>
- <span className="max-w-28 truncate text-muted-foreground">{options.find((option) => option.value === value)?.label ?? value}</span>
+ <span className="shrink-0 text-start">{label}</span>
+ <span className="min-w-0 flex-1 truncate text-end text-muted-foreground">
+ {options.find((option) => option.value === value)?.label ?? value}
+ </span>
<ChevronRightIcon className={cn(iconClass, "rtl:rotate-180")} />
</DropdownMenuTrigger>
{/* Like a nested submenu: when neither side has room (narrow screens), drop below the row instead of overflowing. */}
diff --git a/web/src/locales/ar.json b/web/src/locales/ar.json
index 5e9427308..65510c330 100644
--- a/web/src/locales/ar.json
+++ b/web/src/locales/ar.json
@@ -1000,6 +1000,7 @@
"create-success": "تم إنشاء المساحة",
"creator-admin-note": "ستصبح أول مدير.",
"current": "مساحة",
+ "no-space": "بلا مساحة",
"custom-id-conflict": "هذه المساحة UID مُستخدمة بالفعل.",
"custom-id-help": "مُستخدمة في الروابط وطلبات API. لا يمكن تغييرها لاحقًا. استخدم من 1 إلى 36 حرفًا أو رقمًا أو واصلة ASCII؛ لا تبدأ أو تنتهي بواصلة.",
"custom-id-invalid": "استخدم من 1 إلى 36 حرفًا أو رقمًا أو واصلة ASCII، بدون واصلة في البداية أو النهاية.",
diff --git a/web/src/locales/az.json b/web/src/locales/az.json
index 776eba7b1..503acb3ba 100644
--- a/web/src/locales/az.json
+++ b/web/src/locales/az.json
@@ -996,6 +996,7 @@
"create-success": "Sahə yaradıldı",
"creator-admin-note": "Siz ilk admin olacaqsınız.",
"current": "Sahə",
+ "no-space": "Məkan yoxdur",
"custom-id-conflict": "Bu Sahə UID-i artıq istifadədədir.",
"custom-id-help": "Keçidlərdə və API sorğularında istifadə olunur. Sonradan dəyişdirilə bilməz. 1–36 ASCII hərf, rəqəm və ya defis işlədin; defislə başlamayın və bitirməyin.",
"custom-id-invalid": "1–36 ASCII hərf, rəqəm və ya defis işlədin; əvvəldə və sonda defis olmasın.",
diff --git a/web/src/locales/bg.json b/web/src/locales/bg.json
index 9bd10189c..cddfb4367 100644
--- a/web/src/locales/bg.json
+++ b/web/src/locales/bg.json
@@ -1000,6 +1000,7 @@
"create-success": "Пространството е създадено",
"creator-admin-note": "Вие ще станете първият администратор.",
"current": "Пространство",
+ "no-space": "Без пространство",
"custom-id-conflict": "Това пространство UID вече се използва.",
"custom-id-help": "Използва се във връзки и API заявки. Не може да се промени по-късно. Използвайте 1–36 ASCII букви, цифри или тирета; не започвайте и не завършвайте с тире.",
"custom-id-invalid": "Използвайте 1–36 ASCII букви, цифри или тирета, без тире в началото или края.",
diff --git a/web/src/locales/ca.json b/web/src/locales/ca.json
index b7e24333b..b644d9ac1 100644
--- a/web/src/locales/ca.json
+++ b/web/src/locales/ca.json
@@ -1000,6 +1000,7 @@
"create-success": "Espai creat",
"creator-admin-note": "Et convertiràs en el primer administrador.",
"current": "Espai",
+ "no-space": "Sense espai",
"custom-id-conflict": "Aquest espai UID ja està en ús.",
"custom-id-help": "S'utilitza en enllaços i sol·licituds API. No es pot canviar més tard. Utilitzeu 1–36 ASCII lletres, números o guions; no comenceu ni acabeu amb un guió.",
"custom-id-invalid": "Utilitzeu 1–36 ASCII lletres, números o guions, sense un guió al principi o al final.",
diff --git a/web/src/locales/cs.json b/web/src/locales/cs.json
index 626b1c4a9..041b6e19b 100644
--- a/web/src/locales/cs.json
+++ b/web/src/locales/cs.json
@@ -1000,6 +1000,7 @@
"create-success": "Prostor vytvořen",
"creator-admin-note": "Stanete se prvním administrátorem.",
"current": "Prostor",
+ "no-space": "Bez prostoru",
"custom-id-conflict": "Tento prostor UID je již používán.",
"custom-id-help": "Používá se v odkazech a požadavcích API. Později to nelze změnit. Používejte 1–36 ASCII písmen, číslic nebo pomlček; nezačínejte ani nekončete pomlčkou.",
"custom-id-invalid": "Používejte 1–36 ASCII písmen, číslic nebo pomlček bez pomlčky na začátku nebo na konci.",
diff --git a/web/src/locales/da.json b/web/src/locales/da.json
index 8f60a9c9d..96b12eb5d 100644
--- a/web/src/locales/da.json
+++ b/web/src/locales/da.json
@@ -1000,6 +1000,7 @@
"create-success": "Rum oprettet",
"creator-admin-note": "Du bliver den første administrator.",
"current": "Rum",
+ "no-space": "Intet rum",
"custom-id-conflict": "Dette rum UID er allerede i brug.",
"custom-id-help": "Bruges i links og API anmodninger. Det kan ikke ændres senere. Brug 1–36 ASCII bogstaver, tal eller bindestreger; start eller slut ikke med en bindestreg.",
"custom-id-invalid": "Brug 1–36 ASCII bogstaver, tal eller bindestreger uden en bindestreg i begyndelsen eller slutningen.",
diff --git a/web/src/locales/de.json b/web/src/locales/de.json
index fdeb9b1ad..de84cb8bf 100644
--- a/web/src/locales/de.json
+++ b/web/src/locales/de.json
@@ -1000,6 +1000,7 @@
"create-success": "Bereich erstellt",
"creator-admin-note": "Sie werden der erste Administrator.",
"current": "Bereich",
+ "no-space": "Kein Bereich",
"custom-id-conflict": "Diese Bereichs-UID wird bereits verwendet.",
"custom-id-help": "Wird in Links und API-Anfragen verwendet. Kann später nicht geändert werden. Verwenden Sie 1–36 ASCII Buchstaben, Zahlen oder Bindestriche; beginnen oder enden Sie nicht mit einem Bindestrich.",
"custom-id-invalid": "Verwenden Sie 1–36 ASCII Buchstaben, Zahlen oder Bindestriche, ohne Bindestrich am Anfang oder Ende.",
diff --git a/web/src/locales/el.json b/web/src/locales/el.json
index f9aab4343..5f70b7682 100644
--- a/web/src/locales/el.json
+++ b/web/src/locales/el.json
@@ -1000,6 +1000,7 @@
"create-success": "Ο χώρος δημιουργήθηκε",
"creator-admin-note": "Θα γίνετε ο πρώτος διαχειριστής.",
"current": "Χώρος",
+ "no-space": "Χωρίς χώρο",
"custom-id-conflict": "Αυτός ο Χώρος UID χρησιμοποιείται ήδη.",
"custom-id-help": "Χρησιμοποιείται σε συνδέσμους και API αιτήματα. Δεν μπορεί να αλλάξει αργότερα. Χρησιμοποιήστε γράμματα, αριθμούς ή παύλες 1–36 ASCII. Μην ξεκινάτε ή τελειώνετε με παύλα.",
"custom-id-invalid": "Χρησιμοποιήστε γράμματα, αριθμούς ή παύλες 1–36 ASCII, χωρίς παύλα στην αρχή ή στο τέλος.",
diff --git a/web/src/locales/en-GB.json b/web/src/locales/en-GB.json
index 3f4f1c710..4048a9441 100644
--- a/web/src/locales/en-GB.json
+++ b/web/src/locales/en-GB.json
@@ -1000,6 +1000,7 @@
"create-success": "Space created",
"creator-admin-note": "You'll become the first admin.",
"current": "Space",
+ "no-space": "No space",
"custom-id-conflict": "This Space UID is already in use.",
"custom-id-help": "Used in links and API requests. It can't be changed later. Use 1–36 ASCII letters, numbers, or hyphens; don't start or end with a hyphen.",
"custom-id-invalid": "Use 1–36 ASCII letters, numbers, or hyphens, without a hyphen at the beginning or end.",
diff --git a/web/src/locales/en.json b/web/src/locales/en.json
index b9bcee77b..2180b5e7a 100644
--- a/web/src/locales/en.json
+++ b/web/src/locales/en.json
@@ -996,6 +996,7 @@
"create-success": "Space created",
"creator-admin-note": "You'll become the first admin.",
"current": "Space",
+ "no-space": "No space",
"custom-id-conflict": "This Space UID is already in use.",
"custom-id-help": "Used in links and API requests. It can't be changed later. Use 1–36 ASCII letters, numbers, or hyphens; don't start or end with a hyphen.",
"custom-id-invalid": "Use 1–36 ASCII letters, numbers, or hyphens, without a hyphen at the beginning or end.",
diff --git a/web/src/locales/es.json b/web/src/locales/es.json
index e39d4b2f8..351978a75 100644
--- a/web/src/locales/es.json
+++ b/web/src/locales/es.json
@@ -1000,6 +1000,7 @@
"create-success": "Espacio creado",
"creator-admin-note": "Serás el primer administrador.",
"current": "Espacio",
+ "no-space": "Sin espacio",
"custom-id-conflict": "Este espacio UID ya está en uso.",
"custom-id-help": "Se usa en enlaces y solicitudes API. No se puede modificar posteriormente. Use de 1 a 36 ASCII letras, números o guiones; no comience ni termine con un guion.",
"custom-id-invalid": "Use de 1 a 36 ASCII letras, números o guiones, sin guion al principio ni al final.",
diff --git a/web/src/locales/et.json b/web/src/locales/et.json
index 241230db7..ac4380e70 100644
--- a/web/src/locales/et.json
+++ b/web/src/locales/et.json
@@ -1000,6 +1000,7 @@
"create-success": "Ruum loodud",
"creator-admin-note": "Sinust saab esimene administraator.",
"current": "Ruum",
+ "no-space": "Ruum puudub",
"custom-id-conflict": "See ruum UID on juba kasutusel.",
"custom-id-help": "Kasutatakse linkides ja API päringutes. Seda ei saa hiljem muuta. Kasutage 1–36 ASCII tähte, numbrit või sidekriipsu; ärge alustage ega lõpetage sidekriipsuga.",
"custom-id-invalid": "Kasutage 1–36 ASCII tähte, numbrit või sidekriipsu, ilma sidekriipsuta alguses ega lõpus.",
diff --git a/web/src/locales/fa.json b/web/src/locales/fa.json
index 810ab2a27..69425b213 100644
--- a/web/src/locales/fa.json
+++ b/web/src/locales/fa.json
@@ -1000,6 +1000,7 @@
"create-success": "فضا ایجاد شد",
"creator-admin-note": "شما اولین مدیر خواهید شد.",
"current": "فضا",
+ "no-space": "بدون فضا",
"custom-id-conflict": "این فضا UID در حال حاضر استفاده می‌شود.",
"custom-id-help": "در لینک‌ها و درخواست‌های API استفاده می‌شود. بعداً قابل تغییر نیست. از حروف، اعداد یا خط فاصله 1 تا 36 ASCII استفاده کنید؛ با خط فاصله شروع یا پایان ندهید.",
"custom-id-invalid": "از حروف، اعداد یا خط فاصله 1 تا 36 ASCII استفاده کنید، بدون خط فاصله در ابتدا یا انتها.",
diff --git a/web/src/locales/fi.json b/web/src/locales/fi.json
index b5b54a0eb..e337d0d6f 100644
--- a/web/src/locales/fi.json
+++ b/web/src/locales/fi.json
@@ -1000,6 +1000,7 @@
"create-success": "Tila luotu",
"creator-admin-note": "Sinusta tulee ensimmäinen ylläpitäjä.",
"current": "Tila",
+ "no-space": "Ei tilaa",
"custom-id-conflict": "Tämä tila UID on jo käytössä.",
"custom-id-help": "Käytetään linkeissä ja API-pyynnöissä. Sitä ei voi muuttaa myöhemmin. Käytä 1–36 ASCII kirjainta, numeroa tai yhdysmerkkiä; älä aloita tai lopeta yhdysmerkillä.",
"custom-id-invalid": "Käytä 1–36 ASCII kirjainta, numeroa tai yhdysmerkkiä ilman yhdysmerkkiä alussa tai lopussa.",
diff --git a/web/src/locales/fr.json b/web/src/locales/fr.json
index 68c59cc30..1e5dfcf0a 100644
--- a/web/src/locales/fr.json
+++ b/web/src/locales/fr.json
@@ -1000,6 +1000,7 @@
"create-success": "Espace créé",
"creator-admin-note": "Vous serez le premier administrateur.",
"current": "Espace",
+ "no-space": "Aucun espace",
"custom-id-conflict": "Cet espace UID est déjà utilisé.",
"custom-id-help": "Utilisé dans les liens et les requêtes API. Il ne peut pas être modifié ultérieurement. Utilisez 1 à 36 ASCII lettres, chiffres ou tirets ; ne commencez ni ne terminez par un tiret.",
"custom-id-invalid": "Utilisez 1 à 36 ASCII lettres, chiffres ou tirets, sans tiret au début ni à la fin.",
diff --git a/web/src/locales/gl.json b/web/src/locales/gl.json
index e80aceedb..2c4fc227a 100644
--- a/web/src/locales/gl.json
+++ b/web/src/locales/gl.json
@@ -1000,6 +1000,7 @@
"create-success": "Espazo creado",
"creator-admin-note": "Converteraste no primeiro administrador.",
"current": "Espazo",
+ "no-space": "Sen espazo",
"custom-id-conflict": "Este espazo UID xa está en uso.",
"custom-id-help": "Úsase en ligazóns e solicitudes API. Non se pode cambiar máis tarde. Usa de 1 a 36 ASCII letras, números ou guións; non comeces nin remates cun guión.",
"custom-id-invalid": "Usa de 1 a 36 ASCII letras, números ou guións, sen un guión ao principio ou ao final.",
diff --git a/web/src/locales/he.json b/web/src/locales/he.json
index 773ac7152..e8adbded0 100644
--- a/web/src/locales/he.json
+++ b/web/src/locales/he.json
@@ -1000,6 +1000,7 @@
"create-success": "נוצר מרחב",
"creator-admin-note": "תהפוך למנהל הראשון.",
"current": "מרחב",
+ "no-space": "ללא מרחב",
"custom-id-conflict": "מרחב זה UID כבר בשימוש.",
"custom-id-help": "משמש בקישורים ובקשות API. לא ניתן לשנותו מאוחר יותר. השתמש באותיות, מספרים או מקפים 1–36 ASCII; אין להתחיל או לסיים במקף.",
"custom-id-invalid": "השתמש באותיות, מספרים או מקפים 1–36 ASCII, ללא מקף בהתחלה או בסוף.",
diff --git a/web/src/locales/hi.json b/web/src/locales/hi.json
index 3ca3ab350..240aa4298 100644
--- a/web/src/locales/hi.json
+++ b/web/src/locales/hi.json
@@ -1000,6 +1000,7 @@
"create-success": "स्पेस बनाया गया",
"creator-admin-note": "आप पहले एडमिन बन जाएंगे.",
"current": "स्पेस",
+ "no-space": "कोई स्पेस नहीं",
"custom-id-conflict": "यह स्पेस UID पहले से इस्तेमाल में है.",
"custom-id-help": "लिंक और API रिक्वेस्ट में इस्तेमाल किया जाता है. इसे बाद में बदला नहीं जा सकता. 1–36 ASCII लेटर, नंबर या हाइफ़न का इस्तेमाल करें; हाइफ़न से शुरू या खत्म न करें.",
"custom-id-invalid": "1–36 ASCII लेटर, नंबर या हाइफ़न का इस्तेमाल करें, बिना शुरुआत या आखिर में हाइफ़न के.",
diff --git a/web/src/locales/hr.json b/web/src/locales/hr.json
index 8eef4e027..6769f97bb 100644
--- a/web/src/locales/hr.json
+++ b/web/src/locales/hr.json
@@ -1000,6 +1000,7 @@
"create-success": "Prostor stvoren",
"creator-admin-note": "Postat ćete prvi administrator.",
"current": "Prostor",
+ "no-space": "Bez prostora",
"custom-id-conflict": "Ovaj prostor UID već se koristi.",
"custom-id-help": "Koristi se u poveznicama i API zahtjevima. Ne može se kasnije promijeniti. Koristite 1–36 ASCII slova, brojeva ili crtica; nemojte započinjati ili završavati crticom.",
"custom-id-invalid": "Koristite 1–36 ASCII slova, brojeva ili crtica, bez crtice na početku ili kraju.",
diff --git a/web/src/locales/hu.json b/web/src/locales/hu.json
index b0778e337..020d6e8ca 100644
--- a/web/src/locales/hu.json
+++ b/web/src/locales/hu.json
@@ -1000,6 +1000,7 @@
"create-success": "Tér létrehozva",
"creator-admin-note": "Te leszel az első adminisztrátor.",
"current": "Tér",
+ "no-space": "Nincs tér",
"custom-id-conflict": "Ez a tér (UID) már használatban van.",
"custom-id-help": "Hivatkozásokban és API kérésekben használatos. Később nem módosítható. Használjon 1–36 ASCII betűt, számot vagy kötőjelet; ne kezdődjön vagy végződjön kötőjellel.",
"custom-id-invalid": "Használjon 1–36 ASCII betűt, számot vagy kötőjelet, kötőjel nélkül az elején vagy a végén.",
diff --git a/web/src/locales/id.json b/web/src/locales/id.json
index f03685249..40259de85 100644
--- a/web/src/locales/id.json
+++ b/web/src/locales/id.json
@@ -1000,6 +1000,7 @@
"create-success": "Ruang dibuat",
"creator-admin-note": "Anda akan menjadi admin pertama.",
"current": "Ruang",
+ "no-space": "Tanpa ruang",
"custom-id-conflict": "Ruang UID ini sudah digunakan.",
"custom-id-help": "Digunakan dalam tautan dan permintaan API. Tidak dapat diubah nanti. Gunakan 1–36 huruf, angka, atau tanda hubung ASCII; jangan diawali atau diakhiri dengan tanda hubung.",
"custom-id-invalid": "Gunakan 1–36 huruf, angka, atau tanda hubung ASCII, tanpa tanda hubung di awal atau akhir.",
diff --git a/web/src/locales/it.json b/web/src/locales/it.json
index 9367076ab..0ecbb0039 100644
--- a/web/src/locales/it.json
+++ b/web/src/locales/it.json
@@ -1000,6 +1000,7 @@
"create-success": "Spazio creato",
"creator-admin-note": "Diventerai il primo amministratore.",
"current": "Spazio",
+ "no-space": "Nessuno spazio",
"custom-id-conflict": "Questo spazio UID è già in uso.",
"custom-id-help": "Utilizzato nei link e nelle richieste API. Non può essere modificato in seguito. Utilizzare da 1 a 36 ASCII lettere, numeri o trattini; non iniziare o terminare con un trattino.",
"custom-id-invalid": "Utilizzare da 1 a 36 ASCII lettere, numeri o trattini, senza trattino all'inizio o alla fine.",
diff --git a/web/src/locales/ja.json b/web/src/locales/ja.json
index 61cea600e..60c19863f 100644
--- a/web/src/locales/ja.json
+++ b/web/src/locales/ja.json
@@ -1000,6 +1000,7 @@
"create-success": "スペースが作成されました",
"creator-admin-note": "あなたが最初の管理者になります。",
"current": "スペース",
+ "no-space": "スペースなし",
"custom-id-conflict": "このスペース UID は既に使用されています。",
"custom-id-help": "リンクおよび API リクエストで使用されます。後から変更することはできません。1~36文字の ASCII の英字、数字、またはハイフンを使用してください。ハイフンで開始または終了しないでください。",
"custom-id-invalid": "1~36文字の ASCII の英字、数字、またはハイフンを使用してください。ハイフンで開始または終了しないでください。",
diff --git a/web/src/locales/ka-GE.json b/web/src/locales/ka-GE.json
index a36710220..7a26b363a 100644
--- a/web/src/locales/ka-GE.json
+++ b/web/src/locales/ka-GE.json
@@ -1000,6 +1000,7 @@
"create-success": "სივრცე შეიქმნა",
"creator-admin-note": "თქვენ გახდებით პირველი ადმინისტრატორი.",
"current": "სივრცე",
+ "no-space": "სივრცის გარეშე",
"custom-id-conflict": "ეს სივრცე UID უკვე გამოიყენება.",
"custom-id-help": "გამოიყენება ბმულებსა და API მოთხოვნებში. მისი შეცვლა მოგვიანებით შეუძლებელია. გამოიყენეთ 1–36 ASCII ასოები, რიცხვები ან დეფისები; არ დაიწყოთ ან დასრულდეთ დეფისით.",
"custom-id-invalid": "გამოიყენეთ 1–36 ASCII ასოები, რიცხვები ან დეფისები, დასაწყისში ან ბოლოს დეფისის გარეშე.",
diff --git a/web/src/locales/ko.json b/web/src/locales/ko.json
index d87999e67..d2ff4b598 100644
--- a/web/src/locales/ko.json
+++ b/web/src/locales/ko.json
@@ -1000,6 +1000,7 @@
"create-success": "공간이 생성되었습니다.",
"creator-admin-note": "초대 관리자가 됩니다.",
"current": "공간",
+ "no-space": "스페이스 없음",
"custom-id-conflict": "이 공간 UID은 이미 사용 중입니다.",
"custom-id-help": "링크 및 API 요청에 사용됩니다. 나중에 변경할 수 없습니다. 1~36개의 ASCII 문자, 숫자 또는 하이픈을 사용하세요. 하이픈으로 시작하거나 끝나지 않도록 하세요.",
"custom-id-invalid": "1~36개의 ASCII 문자, 숫자 또는 하이픈을 사용하세요. 시작이나 끝에 하이픈을 사용하지 마세요.",
diff --git a/web/src/locales/lt.json b/web/src/locales/lt.json
index 4e182a914..af6136497 100644
--- a/web/src/locales/lt.json
+++ b/web/src/locales/lt.json
@@ -1000,6 +1000,7 @@
"create-success": "Erdvė sukurta",
"creator-admin-note": "Jūs tapsite pirmuoju administratoriumi.",
"current": "Erdvė",
+ "no-space": "Be erdvės",
"custom-id-conflict": "Ši erdvė UID jau naudojama.",
"custom-id-help": "Naudojama nuorodose ir API užklausose. Vėliau pakeisti negalima. Naudokite 1–36 ASCII raides, skaičius arba brūkšnelius; nepradėkite ir nesibaikite brūkšneliu.",
"custom-id-invalid": "Naudokite 1–36 ASCII raides, skaičius arba brūkšnelius be brūkšnelio pradžioje ar pabaigoje.",
diff --git a/web/src/locales/lv.json b/web/src/locales/lv.json
index 8425ae083..be6a3b455 100644
--- a/web/src/locales/lv.json
+++ b/web/src/locales/lv.json
@@ -1000,6 +1000,7 @@
"create-success": "Telpa izveidota",
"creator-admin-note": "Jūs kļūsiet par pirmo administratoru.",
"current": "Telpa",
+ "no-space": "Bez telpas",
"custom-id-conflict": "Šī telpa UID jau tiek izmantota.",
"custom-id-help": "Izmanto saitēs un API pieprasījumos. To vēlāk nevar mainīt. Izmantojiet 1–36 ASCII burtus, ciparus vai defises; nesāciet un nebeidziet ar defisi.",
"custom-id-invalid": "Izmantojiet 1–36 ASCII burtus, ciparus vai defises, bez defises sākumā vai beigās.",
diff --git a/web/src/locales/mr.json b/web/src/locales/mr.json
index 1516ba85e..89c4d8bbc 100644
--- a/web/src/locales/mr.json
+++ b/web/src/locales/mr.json
@@ -1000,6 +1000,7 @@
"create-success": "जागा तयार झाली",
"creator-admin-note": "तुम्ही पहिले प्रशासक व्हाल.",
"current": "जागा",
+ "no-space": "स्पेस नाही",
"custom-id-conflict": "ही जागा UID आधीच वापरात आहे.",
"custom-id-help": "लिंक्स आणि API विनंत्यांमध्ये वापरले जाते. ते नंतर बदलता येणार नाही. १-३६ ASCII अक्षरे, अंक किंवा हायफन वापरा; सुरुवात किंवा शेवट हायफनने करू नका.",
"custom-id-invalid": "सुरुवातीला किंवा शेवटी हायफन न वापरता १-३६ ASCII अक्षरे, अंक किंवा हायफन वापरा.",
diff --git a/web/src/locales/nb.json b/web/src/locales/nb.json
index b3cf601c4..b10489b02 100644
--- a/web/src/locales/nb.json
+++ b/web/src/locales/nb.json
@@ -1000,6 +1000,7 @@
"create-success": "Rom opprettet",
"creator-admin-note": "Du blir den første administratoren.",
"current": "Rom",
+ "no-space": "Ingen plass",
"custom-id-conflict": "Dette rommet UID er allerede i bruk.",
"custom-id-help": "Brukes i lenker og API-forespørsler. Kan ikke endres senere. Bruk 1–36 ASCII bokstaver, tall eller bindestreker; ikke start eller slutt med bindestrek.",
"custom-id-invalid": "Bruk 1–36 ASCII bokstaver, tall eller bindestreker, uten bindestrek i begynnelsen eller slutten.",
diff --git a/web/src/locales/nl.json b/web/src/locales/nl.json
index 66254533f..efaf91b91 100644
--- a/web/src/locales/nl.json
+++ b/web/src/locales/nl.json
@@ -1000,6 +1000,7 @@
"create-success": "Ruimte aangemaakt",
"creator-admin-note": "Je wordt de eerste beheerder.",
"current": "Ruimte",
+ "no-space": "Geen ruimte",
"custom-id-conflict": "Deze ruimte UID is al in gebruik.",
"custom-id-help": "Gebruikt in links en API-verzoeken. Kan later niet meer worden gewijzigd. Gebruik 1–36 ASCII letters, cijfers of koppeltekens; begin of eindig niet met een koppelteken.",
"custom-id-invalid": "Gebruik 1–36 ASCII letters, cijfers of koppeltekens, zonder koppelteken aan het begin of einde.",
diff --git a/web/src/locales/pl.json b/web/src/locales/pl.json
index 2b2ee3f5f..287042a98 100644
--- a/web/src/locales/pl.json
+++ b/web/src/locales/pl.json
@@ -1000,6 +1000,7 @@
"create-success": "Utworzono przestrzeń",
"creator-admin-note": "Zostaniesz pierwszym administratorem.",
"current": "Przestrzeń",
+ "no-space": "Bez przestrzeni",
"custom-id-conflict": "Ta przestrzeń UID jest już używana.",
"custom-id-help": "Używana w linkach i prośbach o API. Nie można jej później zmienić. Użyj 1–36 ASCII liter, cyfr lub łączników; nie zaczynaj ani nie kończ łącznikiem.",
"custom-id-invalid": "Użyj 1–36 ASCII liter, cyfr lub myślników, bez myślnika na początku lub na końcu.",
diff --git a/web/src/locales/pt-BR.json b/web/src/locales/pt-BR.json
index 3ed26e041..37b209e3d 100644
--- a/web/src/locales/pt-BR.json
+++ b/web/src/locales/pt-BR.json
@@ -1000,6 +1000,7 @@
"create-success": "Espaço criado",
"creator-admin-note": "Você será o primeiro administrador.",
"current": "Espaço",
+ "no-space": "Sem espaço",
"custom-id-conflict": "Este espaço UID já está em uso.",
"custom-id-help": "Usado em links e solicitações API. Não pode ser alterado posteriormente. Use de 1 a 36 ASCII letras, números ou hífens; não comece nem termine com um hífen.",
"custom-id-invalid": "Use de 1 a 36 ASCII letras, números ou hífens, sem hífen no início ou no fim.",
diff --git a/web/src/locales/pt-PT.json b/web/src/locales/pt-PT.json
index ab1205810..fcb1817d5 100644
--- a/web/src/locales/pt-PT.json
+++ b/web/src/locales/pt-PT.json
@@ -1000,6 +1000,7 @@
"create-success": "Espaço criado",
"creator-admin-note": "Será o primeiro administrador.",
"current": "Espaço",
+ "no-space": "Sem espaço",
"custom-id-conflict": "Este espaço UID já está em utilização.",
"custom-id-help": "Utilizado em ligações e pedidos API. Não pode ser alterado posteriormente. Utilize de 1 a 36 ASCII letras, números ou hífens; não comece nem termine com um hífen.",
"custom-id-invalid": "Utilizar de 1 a 36 ASCII letras, números ou hífens, sem hífen no início ou no fim.",
diff --git a/web/src/locales/ro.json b/web/src/locales/ro.json
index 37bc9aa78..e4ed38008 100644
--- a/web/src/locales/ro.json
+++ b/web/src/locales/ro.json
@@ -1000,6 +1000,7 @@
"create-success": "Spațiu creat",
"creator-admin-note": "Vei deveni primul administrator.",
"current": "Spațiu",
+ "no-space": "Fără spațiu",
"custom-id-conflict": "Acest spațiu UID este deja utilizat.",
"custom-id-help": "Folosit în linkuri și cereri API. Nu poate fi modificat ulterior. Folosește 1–36 ASCII litere, cifre sau cratime; nu începe sau se termină cu o cratimă.",
"custom-id-invalid": "Folosește 1–36 ASCII litere, cifre sau cratime, fără cratimă la început sau la sfârșit.",
diff --git a/web/src/locales/ru.json b/web/src/locales/ru.json
index 093cc9548..5763e0c8e 100644
--- a/web/src/locales/ru.json
+++ b/web/src/locales/ru.json
@@ -1000,6 +1000,7 @@
"create-success": "Пространство создано",
"creator-admin-note": "Вы станете первым администратором.",
"current": "Пространство",
+ "no-space": "Без пространства",
"custom-id-conflict": "Это пространство UID уже используется.",
"custom-id-help": "Используется в ссылках и запросах API. Его нельзя изменить позже. Используйте от 1 до 36 букв, цифр или дефисов ASCII; не начинайте и не заканчивайте дефисом.",
"custom-id-invalid": "Используйте 1–36 ASCII букв, цифр или дефисов без дефиса в начале или конце.",
diff --git a/web/src/locales/sk.json b/web/src/locales/sk.json
index 647140924..7f7f68a11 100644
--- a/web/src/locales/sk.json
+++ b/web/src/locales/sk.json
@@ -1000,6 +1000,7 @@
"create-success": "Priestor vytvorený",
"creator-admin-note": "Stanete sa prvým správcom.",
"current": "Priestor",
+ "no-space": "Bez priestoru",
"custom-id-conflict": "Tento priestor UID sa už používa.",
"custom-id-help": "Používa sa v odkazoch a požiadavkách API. Neskôr sa to nedá zmeniť. Použite 1–36 ASCII písmen, číslic alebo pomlčiek; nezačínajte ani nekončite pomlčkou.",
"custom-id-invalid": "Použite 1–36 ASCII písmen, číslic alebo pomlčiek bez pomlčky na začiatku alebo na konci.",
diff --git a/web/src/locales/sl.json b/web/src/locales/sl.json
index 2fef43947..06735c17b 100644
--- a/web/src/locales/sl.json
+++ b/web/src/locales/sl.json
@@ -1000,6 +1000,7 @@
"create-success": "Prostor ustvarjen",
"creator-admin-note": "Postali boste prvi skrbnik.",
"current": "Prostor",
+ "no-space": "Brez prostora",
"custom-id-conflict": "Ta prostor UID je že v uporabi.",
"custom-id-help": "Uporablja se v povezavah in zahtevah API. Kasneje ga ni mogoče spremeniti. Uporabite črke, številke ali vezaje od 1 do 36 ASCII; ne začnite ali končajte z vezajem.",
"custom-id-invalid": "Uporabite črke, številke ali vezaje od 1 do 36 ASCII brez vezaja na začetku ali koncu.",
diff --git a/web/src/locales/sr.json b/web/src/locales/sr.json
index f0609a928..5edf2ac58 100644
--- a/web/src/locales/sr.json
+++ b/web/src/locales/sr.json
@@ -1000,6 +1000,7 @@
"create-success": "Простор је креиран",
"creator-admin-note": "Постаћете први администратор.",
"current": "Простор",
+ "no-space": "Без простора",
"custom-id-conflict": "Овај простор UID је већ у употреби.",
"custom-id-help": "Користи се у линковима и API захтевима. Не може се касније променити. Користите 1–36 ASCII слова, бројева или цртица; не почињите нити се завршавајте цртицом.",
"custom-id-invalid": "Користите 1–36 ASCII слова, бројева или цртица, без цртице на почетку или крају.",
diff --git a/web/src/locales/sv.json b/web/src/locales/sv.json
index 05734443d..795da3bad 100644
--- a/web/src/locales/sv.json
+++ b/web/src/locales/sv.json
@@ -1000,6 +1000,7 @@
"create-success": "Utrymme skapat",
"creator-admin-note": "Du blir den första administratören.",
"current": "Utrymme",
+ "no-space": "Inget utrymme",
"custom-id-conflict": "Detta utrymme UID används redan.",
"custom-id-help": "Används i länkar och API-förfrågningar. Kan inte ändras senare. Använd 1–36 ASCII bokstäver, siffror eller bindestreck; börja eller sluta inte med ett bindestreck.",
"custom-id-invalid": "Använd 1–36 ASCII bokstäver, siffror eller bindestreck, utan bindestreck i början eller slutet.",
diff --git a/web/src/locales/th.json b/web/src/locales/th.json
index 5781e099c..bc39aa6bb 100644
--- a/web/src/locales/th.json
+++ b/web/src/locales/th.json
@@ -1000,6 +1000,7 @@
"create-success": "สร้างพื้นที่แล้ว",
"creator-admin-note": "คุณจะเป็นผู้ดูแลระบบคนแรก",
"current": "พื้นที่",
+ "no-space": "ไม่มีพื้นที่",
"custom-id-conflict": "พื้นที่ UID นี้ถูกใช้งานอยู่แล้ว",
"custom-id-help": "ใช้ในลิงก์และคำขอ API ไม่สามารถเปลี่ยนแปลงได้ในภายหลัง ใช้ตัวอักษร ตัวเลข หรือเครื่องหมายยัติภังค์ 1–36 ตัว ASCII ห้ามขึ้นต้นหรือลงท้ายด้วยเครื่องหมายยัติภังค์",
"custom-id-invalid": "ใช้ตัวอักษร ตัวเลข หรือเครื่องหมายยัติภังค์ 1–36 ตัว ASCII โดยไม่มีเครื่องหมายยัติภังค์ที่ต้นหรือท้าย",
diff --git a/web/src/locales/tr.json b/web/src/locales/tr.json
index 0e970da70..32d639cd7 100644
--- a/web/src/locales/tr.json
+++ b/web/src/locales/tr.json
@@ -925,6 +925,7 @@
"create-success": "Alan oluşturuldu",
"creator-admin-note": "İlk yönetici siz olacaksınız.",
"current": "Alan",
+ "no-space": "Alan yok",
"custom-id-conflict": "Bu alan UID'si zaten kullanılıyor.",
"custom-id-help": "Bağlantılarda ve API isteklerinde kullanılır. Sonradan değiştirilemez. 1–36 ASCII harf, rakam ya da tire kullanın; tireyle başlamayın ve bitirmeyin.",
"custom-id-invalid": "Başında ve sonunda tire olmadan 1–36 ASCII harf, rakam ya da tire kullanın.",
diff --git a/web/src/locales/uk.json b/web/src/locales/uk.json
index 3fec9bfd9..1c1605957 100644
--- a/web/src/locales/uk.json
+++ b/web/src/locales/uk.json
@@ -1000,6 +1000,7 @@
"create-success": "Простір створено",
"creator-admin-note": "Ви станете першим адміністратором.",
"current": "Простір",
+ "no-space": "Без простору",
"custom-id-conflict": "Цей простір UID вже використовується.",
"custom-id-help": "Використовується в посиланнях та запитах API. Його не можна змінити пізніше. Використовуйте літери, цифри або дефіси від 1 до 36 ASCII; не починайте та не закінчуйте дефісом.",
"custom-id-invalid": "Використовуйте літери, цифри або дефіси від 1 до 36 ASCII без дефісу на початку чи в кінці.",
diff --git a/web/src/locales/vi.json b/web/src/locales/vi.json
index b3395b46b..6bd1eee41 100644
--- a/web/src/locales/vi.json
+++ b/web/src/locales/vi.json
@@ -1000,6 +1000,7 @@
"create-success": "Không gian đã được tạo",
"creator-admin-note": "Bạn sẽ trở thành quản trị viên đầu tiên.",
"current": "Không gian",
+ "no-space": "Không có không gian",
"custom-id-conflict": "Không gian UID này đã được sử dụng.",
"custom-id-help": "Được sử dụng trong các liên kết và yêu cầu API. Không thể thay đổi sau này. Sử dụng 1–36 ASCII chữ cái, số hoặc dấu gạch ngang; không bắt đầu hoặc kết thúc bằng dấu gạch ngang.",
"custom-id-invalid": "Sử dụng 1–36 ASCII chữ cái, số hoặc dấu gạch ngang, không có dấu gạch ngang ở đầu hoặc cuối.",
diff --git a/web/src/locales/zh-Hans.json b/web/src/locales/zh-Hans.json
index 8ebf37f13..75492b2e7 100644
--- a/web/src/locales/zh-Hans.json
+++ b/web/src/locales/zh-Hans.json
@@ -986,6 +986,7 @@
"create-success": "空间已创建",
"creator-admin-note": "您将成为第一个管理员。",
"current": "空间",
+ "no-space": "不属于任何空间",
"custom-id-conflict": "此空间 UID 已被使用。",
"description-placeholder": "此空间的用途是什么?",
"load-error": "无法加载空间",
diff --git a/web/src/locales/zh-Hant.json b/web/src/locales/zh-Hant.json
index bcf317ea4..0209b60d5 100644
--- a/web/src/locales/zh-Hant.json
+++ b/web/src/locales/zh-Hant.json
@@ -952,6 +952,7 @@
"create-success": "已建立空間",
"creator-admin-note": "你將成為第一位管理員。",
"current": "空間",
+ "no-space": "不屬於任何空間",
"custom-id-conflict": "此空間 UID 已被使用。",
"custom-id-help": "用於連結與 API 請求,之後無法變更。請使用 1 至 36 個 ASCII 字母、數字或連字號,且開頭與結尾不得為連字號。",
"custom-id-invalid": "請使用 1 至 36 個 ASCII 字母、數字或連字號,且開頭與結尾不得為連字號。",
diff --git a/web/tests/insert-menu.test.tsx b/web/tests/insert-menu.test.tsx
index 1d4937b25..6e1b9964a 100644
--- a/web/tests/insert-menu.test.tsx
+++ b/web/tests/insert-menu.test.tsx
@@ -10,6 +10,7 @@ vi.mock("@/utils/i18n", async (importOriginal) => ({
}));
vi.mock("@/hooks/useCurrentUser", () => ({ default: () => undefined }));
vi.mock("@/contexts/AuthContext", () => ({ useAuth: () => ({ userGeneralSetting: undefined }) }));
+vi.mock("@/hooks/useSpaceQueries", () => ({ useSpaces: () => ({ data: [] }) }));
vi.mock("@/contexts/SpaceContext", () => ({ useSpaceContext: () => ({ selectedSpaceName: undefined }) }));
vi.mock("@/components/map/useReverseGeocoding", () => ({ useReverseGeocoding: () => ({ data: undefined }) }));
diff --git a/web/tests/memo-editor-cache.test.ts b/web/tests/memo-editor-cache.test.ts
index da2994ad6..06cd2dd83 100644
--- a/web/tests/memo-editor-cache.test.ts
+++ b/web/tests/memo-editor-cache.test.ts
@@ -3,7 +3,7 @@ import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
import { cacheService } from "@/components/MemoEditor/services/cacheService";
import { AttachmentSchema, MotionMediaFamily, MotionMediaRole, MotionMediaSchema } from "@/types/proto/api/v1/attachment_service_pb";
-import { LocationSchema } from "@/types/proto/api/v1/memo_service_pb";
+import { LocationSchema, Visibility } from "@/types/proto/api/v1/memo_service_pb";
describe("memo editor cache", () => {
beforeEach(() => {
@@ -23,7 +23,7 @@ describe("memo editor cache", () => {
it("stores draft content", () => {
const key = cacheService.key("users/steven", "home-memo-editor");
- cacheService.saveNow(key, "- [x] Draft task");
+ cacheService.saveNow(key, { content: "- [x] Draft task", attachments: [] });
expect(cacheService.load(key)).toBe("- [x] Draft task");
});
@@ -31,7 +31,7 @@ describe("memo editor cache", () => {
it("removes empty draft content instead of caching it", () => {
const key = cacheService.key("users/steven", "home-memo-editor");
- cacheService.saveNow(key, "");
+ cacheService.saveNow(key, { content: "", attachments: [] });
expect(cacheService.load(key)).toBe("");
});
@@ -58,7 +58,7 @@ describe("memo editor cache", () => {
}),
});
- cacheService.saveNow(key, "![garden](/file/attachments/image-one)", [attachment]);
+ cacheService.saveNow(key, { content: "![garden](/file/attachments/image-one)", attachments: [attachment] });
const restored = cacheService.loadDraft(key);
expect(restored.content).toBe("![garden](/file/attachments/image-one)");
@@ -95,14 +95,36 @@ describe("memo editor cache", () => {
it("round-trips an edited or removed location and isolates Space drafts", () => {
const point = create(LocationSchema, { latitude: 0, longitude: 135, placeholder: "Cafe" });
- cacheService.saveNow("map:space-a:point", "draft", [], point);
- cacheService.saveNow("map:space-b:point", "draft", [], null);
+ cacheService.saveNow("map:space-a:point", { content: "draft", attachments: [], location: point });
+ cacheService.saveNow("map:space-b:point", { content: "draft", attachments: [], location: null });
expect(cacheService.loadDraft("map:space-a:point").location).toEqual(point);
expect(cacheService.loadDraft("map:space-b:point").location).toBeNull();
localStorage.setItem("legacy", JSON.stringify({ kind: "memos.editor-cache", version: 2, content: "old", attachments: [] }));
expect(cacheService.loadDraft("legacy").location).toBeUndefined();
});
+ it("persists a chosen destination before typing, and clears it with the draft", () => {
+ cacheService.saveNow("destination", { content: "", attachments: [], space: "spaces/work", visibility: Visibility.PRIVATE });
+ expect(cacheService.loadDraft("destination")).toMatchObject({ space: "spaces/work", visibility: Visibility.PRIVATE });
+ cacheService.saveNow("destination", { content: "draft", attachments: [], visibility: Visibility.PRIVATE });
+ expect(cacheService.loadDraft("destination").space).toBeUndefined();
+ cacheService.clear("destination");
+ expect(cacheService.loadDraft("destination").space).toBeUndefined();
+ });
+
+ it("ignores invalid cached settings while preserving legacy content and location", () => {
+ localStorage.setItem(
+ "legacy-location",
+ JSON.stringify({ kind: "memos.editor-cache", version: 3, content: "old", location: null, space: 42, visibility: 999 }),
+ );
+ expect(cacheService.loadDraft("legacy-location")).toMatchObject({
+ content: "old",
+ location: null,
+ space: undefined,
+ visibility: undefined,
+ });
+ });
+
it("keeps the cursor for the next editor mount", () => {
const key = cacheService.key("users/steven", "global-memo-editor");
diff --git a/web/tests/memo-editor-relations.test.ts b/web/tests/memo-editor-relations.test.ts
index 8a2195fd0..0fefc6576 100644
--- a/web/tests/memo-editor-relations.test.ts
+++ b/web/tests/memo-editor-relations.test.ts
@@ -69,9 +69,20 @@ describe("memo editor relation updates", () => {
});
});
+ it("saves the draft destination unless the host fixes the Space", async () => {
+ const state = createInitialState();
+ state.content = "Draft";
+ state.metadata = { ...state.metadata, space: "spaces/work" };
+ await memoService.save(state, {});
+ expect(clients.createMemo).toHaveBeenLastCalledWith({ memo: expect.objectContaining({ space: "spaces/work" }) });
+ await memoService.save(state, { space: "spaces/current" });
+ expect(clients.createMemo).toHaveBeenLastCalledWith({ memo: expect.objectContaining({ space: "spaces/current" }) });
+ });
+
it("does not inherit the selected Space when creating a comment", async () => {
const state = createInitialState();
state.content = "Reply";
+ state.metadata = { ...state.metadata, space: "spaces/draft" };
await memoService.save(state, { parentMemoName: "memos/parent", space: "spaces/product" });
diff --git a/web/tests/memo-move-dialog.test.tsx b/web/tests/memo-move-dialog.test.tsx
index 3ada27be6..5b1ddd6c4 100644
--- a/web/tests/memo-move-dialog.test.tsx
+++ b/web/tests/memo-move-dialog.test.tsx
@@ -36,6 +36,7 @@ describe("Move to Space", () => {
it("requires a new destination and moves with explicit Space audience", async () => {
const close = vi.fn();
render(<MemoMoveDialog memo={memo} onOpenChange={close} />);
+ expect(screen.getByRole("combobox", { name: "space.current" }).querySelector(".bg-sidebar-accent")).not.toBeNull();
expect(screen.getByRole("button", { name: "memo.move.confirm" })).toBeDisabled();
await selectDestination("Product");
fireEvent.click(screen.getByRole("button", { name: "memo.move.confirm" }));
@@ -49,6 +50,7 @@ describe("Move to Space", () => {
it("defaults to Private when unassigning a Space-visible memo", async () => {
render(<MemoMoveDialog memo={memo} onOpenChange={vi.fn()} />);
await selectDestination("memo.move.unassigned");
+ expect(screen.getByRole("combobox", { name: "space.current" }).querySelector(".bg-sidebar-accent")).toBeNull();
fireEvent.click(screen.getByRole("button", { name: "memo.move.confirm" }));
await waitFor(() =>
expect(state.update).toHaveBeenCalledWith({
diff --git a/web/tests/memo-settings.test.tsx b/web/tests/memo-settings.test.tsx
new file mode 100644
index 000000000..3187efed3
--- /dev/null
+++ b/web/tests/memo-settings.test.tsx
@@ -0,0 +1,176 @@
+import { fireEvent, render, screen } from "@testing-library/react";
+import { beforeAll, beforeEach, describe, expect, it, vi } from "vitest";
+import { createInitialState, EditorProvider, useEditorContext, useEditorSelector } from "@/components/MemoEditor/state";
+import { EditorToolbar } from "@/components/MemoEditor/Toolbar/EditorToolbar";
+import MemoSettings from "@/components/MemoEditor/Toolbar/MemoSettings";
+import { Visibility } from "@/types/proto/api/v1/memo_service_pb";
+
+const spacesQuery = vi.hoisted(() => ({
+ data: [
+ { name: "spaces/work", title: "Work", icon: { value: { case: "emoji", value: "💎" } } },
+ { name: "spaces/reading", title: "Reading" },
+ ],
+ isPending: false,
+ isError: false,
+ refetch: vi.fn(),
+}));
+vi.mock("@/components/MemoEditor/Toolbar/InsertMenu", () => ({ default: () => null }));
+vi.mock("@/hooks/useCurrentUser", () => ({ default: () => ({ name: "users/test" }) }));
+vi.mock("@/hooks/useSpaceQueries", () => ({ useSpaces: () => spacesQuery }));
+
+vi.mock("@/utils/i18n", () => ({ useTranslate: () => (key: string) => key }));
+
+// Base UI menus reach for layout/pointer APIs jsdom doesn't implement.
+beforeAll(() => {
+ Element.prototype.scrollIntoView = vi.fn();
+ Element.prototype.hasPointerCapture = vi.fn(() => false);
+ Element.prototype.setPointerCapture = vi.fn();
+ Element.prototype.releasePointerCapture = vi.fn();
+});
+
+const openMenu = async (value: Visibility, onChange = vi.fn(), space?: string) => {
+ render(<MemoSettings value={value} space={space} onChange={onChange} />);
+ fireEvent.click(screen.getByRole("button"));
+ await screen.findByRole("dialog");
+ return onChange;
+};
+
+beforeEach(() => {
+ spacesQuery.isPending = false;
+ spacesQuery.isError = false;
+ spacesQuery.data[0].title = "Work";
+});
+
+describe("MemoSettings", () => {
+ it("omits the Space audience when the edited memo has no Space placement", async () => {
+ await openMenu(Visibility.PRIVATE);
+
+ expect(screen.getAllByRole("radio").map((item) => item.textContent)).toEqual([
+ "memo.visibility.privatememo.visibility.private-description",
+ "memo.visibility.protectedmemo.visibility.protected-description",
+ "memo.visibility.publicmemo.visibility.public-description",
+ ]);
+ });
+
+ it("offers the Space audience with its own description when the edited memo belongs to a Space", async () => {
+ await openMenu(Visibility.PRIVATE, vi.fn(), "spaces/product");
+
+ const spaceItem = screen.getByRole("radio", { name: /memo\.visibility\.space/ });
+ expect(spaceItem).toHaveTextContent("memo.visibility.space-description");
+ });
+
+ it("names the current Space audience even when placement is unavailable", () => {
+ render(<MemoSettings value={Visibility.SPACE} onChange={vi.fn()} />);
+
+ expect(screen.getByRole("button")).toHaveTextContent("memo.visibility.space");
+ });
+
+ it("keeps the current Space audience selectable when placement is unavailable", async () => {
+ await openMenu(Visibility.SPACE);
+
+ expect(screen.getByRole("radio", { name: /memo\.visibility\.space/ })).toBeInTheDocument();
+ });
+
+ it("reports the picked audience", async () => {
+ const onChange = await openMenu(Visibility.PRIVATE);
+
+ fireEvent.click(screen.getByRole("radio", { name: /memo\.visibility\.public/ }));
+
+ expect(onChange).toHaveBeenCalledWith(Visibility.PUBLIC);
+ });
+});
+
+describe("composer Space selection", () => {
+ it("keeps Space choices behind a select in the existing settings popover", async () => {
+ const onSpaceChange = vi.fn();
+ const onChange = vi.fn();
+ render(<MemoSettings value={Visibility.PRIVATE} onChange={onChange} onSpaceChange={onSpaceChange} />);
+ expect(screen.getAllByRole("button")).toHaveLength(1);
+ expect(screen.getByRole("button")).not.toHaveTextContent("space.no-space");
+ fireEvent.click(screen.getByRole("button"));
+ const select = await screen.findByRole("combobox", { name: "space.current" });
+ expect(select).toHaveTextContent("space.no-space");
+ expect(select.querySelector(".bg-sidebar-accent")).toBeNull();
+ expect(screen.queryByRole("option")).not.toBeInTheDocument();
+ fireEvent.click(select);
+ const work = await screen.findByRole("option", { name: "Work" });
+ expect(work.querySelector(".bg-sidebar-accent")).not.toBeNull();
+ fireEvent.pointerDown(work, { pointerType: "mouse" });
+ fireEvent.click(work);
+ expect(onSpaceChange).toHaveBeenCalledWith("spaces/work");
+ expect(onChange).not.toHaveBeenCalled();
+ expect(screen.getByRole("dialog")).toBeInTheDocument();
+ });
+
+ it("clears the destination and retains full long titles for the selected value and options", async () => {
+ const onSpaceChange = vi.fn();
+ const longTitle = "Work " + "a very long Space title ".repeat(15);
+ spacesQuery.data[0].title = longTitle;
+ const { rerender } = render(
+ <MemoSettings value={Visibility.PRIVATE} space="spaces/work" onChange={vi.fn()} onSpaceChange={onSpaceChange} />,
+ );
+ expect(screen.getByRole("button")).toHaveAttribute("title", `${longTitle} · memo.visibility.private`);
+ expect(screen.getByRole("button")).toHaveTextContent("💎");
+ expect(screen.getByRole("button").querySelector(".bg-sidebar-accent")).toBeNull();
+ fireEvent.click(screen.getByRole("button"));
+ const select = await screen.findByRole("combobox");
+ expect(select).toHaveAttribute("title", longTitle);
+ expect(select.querySelector(".bg-sidebar-accent")).not.toBeNull();
+ fireEvent.click(select);
+ expect(await screen.findByRole("option", { name: /Work a very long Space title/ })).toHaveAttribute("title", longTitle);
+ const noSpace = screen.getByRole("option", { name: "space.no-space" });
+ fireEvent.pointerDown(noSpace, { pointerType: "mouse" });
+ fireEvent.click(noSpace);
+ expect(onSpaceChange).toHaveBeenCalledWith(undefined);
+ rerender(<MemoSettings value={Visibility.PRIVATE} onChange={vi.fn()} onSpaceChange={onSpaceChange} />);
+ expect(screen.getByRole("combobox")).toHaveTextContent("space.no-space");
+ spacesQuery.data[0].title = "Work";
+ });
+
+ it("omits the destination section and summary for a fixed Space", async () => {
+ await openMenu(Visibility.PRIVATE, vi.fn(), "spaces/work");
+ expect(screen.queryByRole("combobox")).not.toBeInTheDocument();
+ expect(screen.getByRole("button")).not.toHaveTextContent("Work");
+ });
+
+ it("shows loading and retry states without losing visibility choices", async () => {
+ spacesQuery.isPending = true;
+ const props = { value: Visibility.PRIVATE, onChange: vi.fn(), onSpaceChange: vi.fn() };
+ const { rerender } = render(<MemoSettings {...props} />);
+ fireEvent.click(screen.getByRole("button"));
+ expect(await screen.findByRole("status")).toHaveTextContent("space.loading");
+ spacesQuery.isPending = false;
+ spacesQuery.isError = true;
+ rerender(<MemoSettings {...props} />);
+ expect(screen.getByRole("alert")).toHaveTextContent("space.load-error");
+ fireEvent.click(screen.getByRole("button", { name: "search.retry" }));
+ expect(spacesQuery.refetch).toHaveBeenCalled();
+ expect(screen.getAllByRole("radio")).toHaveLength(3);
+ });
+});
+
+it("clearing Space visibility falls back to Private without discarding content", async () => {
+ let getState: ReturnType<typeof useEditorContext>["getState"];
+ function Toolbar() {
+ getState = useEditorContext().getState;
+ const space = useEditorSelector((state) => state.metadata.space);
+ return <EditorToolbar space={space} canChooseSpace onSave={vi.fn()} onAudioRecorderClick={vi.fn()} onInsertImages={vi.fn()} />;
+ }
+ const initial = createInitialState();
+ initial.content = "Keep this draft";
+ initial.metadata = { ...initial.metadata, space: "spaces/work", visibility: Visibility.SPACE };
+ render(
+ <EditorProvider initialEditorState={initial}>
+ <Toolbar />
+ </EditorProvider>,
+ );
+ fireEvent.click(screen.getByRole("button", { name: "Work · memo.visibility.space" }));
+ fireEvent.click(await screen.findByRole("combobox"));
+ const noSpace = await screen.findByRole("option", { name: "space.no-space" });
+ fireEvent.pointerDown(noSpace, { pointerType: "mouse" });
+ fireEvent.click(noSpace);
+ expect(getState!().metadata.space).toBeUndefined();
+ expect(getState!().metadata.visibility).toBe(Visibility.PRIVATE);
+ expect(getState!().content).toBe("Keep this draft");
+ expect(screen.queryByRole("radio", { name: /memo.visibility.space/ })).not.toBeInTheDocument();
+});
diff --git a/web/tests/space-icon-picker.test.tsx b/web/tests/space-icon-picker.test.tsx
index 50753283e..4bd1ba49e 100644
--- a/web/tests/space-icon-picker.test.tsx
+++ b/web/tests/space-icon-picker.test.tsx
@@ -4,6 +4,7 @@ import { useState } from "react";
import { describe, expect, it, vi } from "vitest";
import SpaceIcon from "@/components/SpaceIcon";
import SpaceIconPicker from "@/components/SpaceIconPicker";
+import SpaceMark from "@/components/SpaceMark";
import { SPACE_EMOJI } from "@/lib/space-emoji";
import { type Space_Icon, Space_IconSchema } from "@/types/proto/api/v1/space_service_pb";
import { FULLY_QUALIFIED_EMOJI } from "@/utils/tag-unicode-data";
@@ -100,4 +101,24 @@ describe("SpaceIcon", () => {
view.rerender(<SpaceIcon icon={icon("future-symbol")} />);
expect(view.container.querySelector(".lucide-astroid")).not.toBeNull();
});
+
+ it("sizes inline emoji independently of surrounding text and keeps them decorative", () => {
+ const view = render(<SpaceIcon icon={icon("🌱", "emoji")} />);
+ expect(screen.getByText("🌱")).toHaveClass("size-4", "text-base");
+ expect(screen.getByText("🌱")).toHaveAttribute("aria-hidden", "true");
+ view.rerender(<SpaceIcon icon={icon("🌱", "emoji")} size={12} />);
+ expect(screen.getByText("🌱")).toHaveClass("size-3", "text-xs");
+ });
+
+ it("uses the same compact identity tile for emoji, symbols, and missing icons", () => {
+ const view = render(<SpaceMark icon={icon("🌱", "emoji")} size="sm" />);
+ expect(view.container.firstElementChild).toHaveClass("size-5", "bg-sidebar-accent");
+ expect(screen.getByText("🌱")).toHaveClass("size-3", "text-sm");
+ view.rerender(<SpaceMark icon={icon("leaf")} size="sm" />);
+ expect(view.container.firstElementChild).toHaveClass("size-5", "bg-sidebar-accent");
+ expect(view.container.querySelector(".lucide-leaf")).toHaveClass("size-3");
+ view.rerender(<SpaceMark size="sm" />);
+ expect(view.container.firstElementChild).toHaveClass("size-5", "bg-sidebar-accent");
+ expect(view.container.querySelector(".lucide-astroid")).toHaveClass("size-3");
+ });
});
diff --git a/web/tests/use-auto-save.test.tsx b/web/tests/use-auto-save.test.tsx
index 49e3d2c49..3025e09d1 100644
--- a/web/tests/use-auto-save.test.tsx
+++ b/web/tests/use-auto-save.test.tsx
@@ -5,6 +5,7 @@ import { useAutoSave } from "@/components/MemoEditor/hooks/useAutoSave";
import { cacheService } from "@/components/MemoEditor/services/cacheService";
import { EditorProvider, useEditorContext } from "@/components/MemoEditor/state";
import { AttachmentSchema } from "@/types/proto/api/v1/attachment_service_pb";
+import { Visibility } from "@/types/proto/api/v1/memo_service_pb";
// Probe surfaces the store's dispatch/actions plus the autosave API so tests can
// drive content changes the way the editor does and assert on cache writes.
@@ -47,7 +48,42 @@ describe("useAutoSave (store-subscribed)", () => {
act(() => {
api.dispatch(api.actions.updateContent("hello world"));
});
- expect(saveSpy).toHaveBeenCalledWith(key, "hello world", [], null);
+ expect(saveSpy).toHaveBeenCalledWith(key, {
+ content: "hello world",
+ attachments: [],
+ location: null,
+ space: undefined,
+ visibility: Visibility.PRIVATE,
+ });
+ });
+
+ it("persists destination and audience changes even when content stays the same", () => {
+ render(
+ <EditorProvider>
+ <Probe username="users/steven" cacheKey="settings" enabled />
+ </EditorProvider>,
+ );
+ saveSpy.mockClear();
+ act(() => {
+ api.dispatch(api.actions.setMetadata({ space: "spaces/work", visibility: Visibility.SPACE }));
+ });
+ expect(saveSpy).toHaveBeenLastCalledWith(cacheService.key("users/steven", "settings"), {
+ content: "",
+ attachments: [],
+ location: null,
+ space: "spaces/work",
+ visibility: Visibility.SPACE,
+ });
+ act(() => {
+ api.dispatch(api.actions.setMetadata({ space: undefined, visibility: Visibility.PRIVATE }));
+ });
+ expect(saveSpy).toHaveBeenLastCalledWith(cacheService.key("users/steven", "settings"), {
+ content: "",
+ attachments: [],
+ location: null,
+ space: undefined,
+ visibility: Visibility.PRIVATE,
+ });
});
it("persists uploaded attachments when editor metadata changes", () => {
@@ -68,7 +104,13 @@ describe("useAutoSave (store-subscribed)", () => {
api.dispatch(api.actions.setMetadata({ attachments: [image] }));
});
- expect(saveSpy).toHaveBeenCalledWith(key, "", [image], null);
+ expect(saveSpy).toHaveBeenCalledWith(key, {
+ content: "",
+ attachments: [image],
+ location: null,
+ space: undefined,
+ visibility: Visibility.PRIVATE,
+ });
});
it("persists metadata changes for an attachment with the same name", () => {
@@ -98,7 +140,13 @@ describe("useAutoSave (store-subscribed)", () => {
api.dispatch(api.actions.setMetadata({ attachments: [updated] }));
});
- expect(saveSpy).toHaveBeenCalledWith(key, "", [updated], null);
+ expect(saveSpy).toHaveBeenCalledWith(key, {
+ content: "",
+ attachments: [updated],
+ location: null,
+ space: undefined,
+ visibility: Visibility.PRIVATE,
+ });
});
it("does not persist when disabled", () => {
diff --git a/web/tests/use-memo-init.test.tsx b/web/tests/use-memo-init.test.tsx
index e1073beb6..132044203 100644
--- a/web/tests/use-memo-init.test.tsx
+++ b/web/tests/use-memo-init.test.tsx
@@ -8,12 +8,20 @@ import { EditorProvider, useEditorContext } from "@/components/MemoEditor/state"
import type { EditorController } from "@/components/MemoEditor/types/editorController";
import { AttachmentSchema } from "@/types/proto/api/v1/attachment_service_pb";
-import { type Location, LocationSchema } from "@/types/proto/api/v1/memo_service_pb";
+import { type Location, LocationSchema, Visibility } from "@/types/proto/api/v1/memo_service_pb";
const editorRef = { current: null } as RefObject<EditorController | null>;
let getEditorState: ReturnType<typeof useEditorContext>["getState"];
-function Probe({ autoFocus, defaultLocation }: { autoFocus?: boolean | (() => boolean); defaultLocation?: Location }) {
+function Probe({
+ autoFocus,
+ defaultLocation,
+ canChooseSpace,
+}: {
+ autoFocus?: boolean | (() => boolean);
+ defaultLocation?: Location;
+ canChooseSpace?: boolean;
+}) {
getEditorState = useEditorContext().getState;
useMemoInit({
editorRef,
@@ -21,6 +29,8 @@ function Probe({ autoFocus, defaultLocation }: { autoFocus?: boolean | (() => bo
cacheKey: "restored-draft",
autoFocus,
defaultLocation,
+ canChooseSpace,
+ defaultVisibility: Visibility.PUBLIC,
});
return null;
}
@@ -45,7 +55,7 @@ describe("useMemoInit", () => {
it.each([true, false])("restores the draft and cursor before evaluating autofocus (%s)", (allowed) => {
vi.useFakeTimers();
const key = cacheService.key("users/steven", "restored-draft");
- cacheService.saveNow(key, "An unfinished memo");
+ cacheService.saveNow(key, { content: "An unfinished memo", attachments: [] });
cacheService.saveCursor(key, 5);
const focus = vi.fn();
const setCursor = vi.fn();
@@ -82,7 +92,11 @@ describe("useMemoInit", () => {
);
expect(getEditorState().metadata.location).toEqual(point);
unmount();
- cacheService.saveNow(cacheService.key("users/steven", "restored-draft"), "Draft without a location", [], null);
+ cacheService.saveNow(cacheService.key("users/steven", "restored-draft"), {
+ content: "Draft without a location",
+ attachments: [],
+ location: null,
+ });
render(
<EditorProvider>
<Probe defaultLocation={point} />
@@ -91,13 +105,33 @@ describe("useMemoInit", () => {
expect(getEditorState().metadata.location).toBeUndefined();
});
+ it.each([true, false])("restores destination only when the composer can choose a Space (%s)", (canChooseSpace) => {
+ cacheService.saveNow(cacheService.key("users/steven", "restored-draft"), {
+ content: "Draft",
+ attachments: [],
+ location: null,
+ space: "spaces/work",
+ visibility: Visibility.PRIVATE,
+ });
+ render(
+ <EditorProvider>
+ <Probe canChooseSpace={canChooseSpace} />
+ </EditorProvider>,
+ );
+ expect(getEditorState().metadata.space).toBe(canChooseSpace ? "spaces/work" : undefined);
+ expect(getEditorState().metadata.visibility).toBe(Visibility.PRIVATE);
+ });
+
it("restores uploaded attachment bindings with a new memo draft", async () => {
const attachment = create(AttachmentSchema, {
name: "attachments/image-one",
filename: "image.png",
type: "image/png",
});
- cacheService.saveNow(cacheService.key("users/steven", "restored-draft"), "![image](/file/attachments/image-one)", [attachment]);
+ cacheService.saveNow(cacheService.key("users/steven", "restored-draft"), {
+ content: "![image](/file/attachments/image-one)",
+ attachments: [attachment],
+ });
render(
<EditorProvider>
diff --git a/web/tests/visibility-selector.test.tsx b/web/tests/visibility-selector.test.tsx
deleted file mode 100644
index 3c92c1539..000000000
--- a/web/tests/visibility-selector.test.tsx
+++ /dev/null
@@ -1,60 +0,0 @@
-import { fireEvent, render, screen } from "@testing-library/react";
-import { beforeAll, describe, expect, it, vi } from "vitest";
-import VisibilitySelector from "@/components/MemoEditor/Toolbar/VisibilitySelector";
-import { Visibility } from "@/types/proto/api/v1/memo_service_pb";
-
-vi.mock("@/utils/i18n", () => ({ useTranslate: () => (key: string) => key }));
-
-// Base UI menus reach for layout/pointer APIs jsdom doesn't implement.
-beforeAll(() => {
- Element.prototype.scrollIntoView = vi.fn();
- Element.prototype.hasPointerCapture = vi.fn(() => false);
- Element.prototype.setPointerCapture = vi.fn();
- Element.prototype.releasePointerCapture = vi.fn();
-});
-
-const openMenu = async (value: Visibility, onChange = vi.fn(), space?: string) => {
- render(<VisibilitySelector value={value} space={space} onChange={onChange} />);
- fireEvent.click(screen.getByRole("button"));
- await screen.findByRole("menu");
- return onChange;
-};
-
-describe("VisibilitySelector", () => {
- it("omits the Space audience when the edited memo has no Space placement", async () => {
- await openMenu(Visibility.PRIVATE);
-
- expect(screen.getAllByRole("menuitem").map((item) => item.textContent)).toEqual([
- "memo.visibility.privatememo.visibility.private-description",
- "memo.visibility.protectedmemo.visibility.protected-description",
- "memo.visibility.publicmemo.visibility.public-description",
- ]);
- });
-
- it("offers the Space audience with its own description when the edited memo belongs to a Space", async () => {
- await openMenu(Visibility.PRIVATE, vi.fn(), "spaces/product");
-
- const spaceItem = screen.getByRole("menuitem", { name: /memo\.visibility\.space/ });
- expect(spaceItem).toHaveTextContent("memo.visibility.space-description");
- });
-
- it("names the current Space audience even when placement is unavailable", () => {
- render(<VisibilitySelector value={Visibility.SPACE} onChange={vi.fn()} />);
-
- expect(screen.getByRole("button")).toHaveTextContent("memo.visibility.space");
- });
-
- it("keeps the current Space audience selectable when placement is unavailable", async () => {
- await openMenu(Visibility.SPACE);
-
- expect(screen.getByRole("menuitem", { name: /memo\.visibility\.space/ })).toBeInTheDocument();
- });
-
- it("reports the picked audience", async () => {
- const onChange = await openMenu(Visibility.PRIVATE);
-
- fireEvent.click(screen.getByRole("menuitem", { name: /memo\.visibility\.public/ }));
-
- expect(onChange).toHaveBeenCalledWith(Visibility.PUBLIC);
- });
-});