@agent-native/core-corpus 0.217.0 → 0.219.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/corpus/README.md +1 -1
- package/corpus/templates/analytics/.agents/skills/hubspot/SKILL.md +5 -3
- package/corpus/templates/analytics/CHANGELOG.md +2 -0
- package/corpus/templates/analytics/app/components/layout/Sidebar.tsx +38 -167
- package/corpus/templates/analytics/changelog/2026-10-16-owned-and-shared-chats-appear-in-separate-history-sections.md +6 -0
- package/corpus/templates/assets/CHANGELOG.md +6 -0
- package/corpus/templates/assets/app/components/layout/Sidebar.tsx +51 -117
- package/corpus/templates/assets/changelog/2026-10-16-owned-and-shared-chats-appear-in-separate-history-sections.md +6 -0
- package/corpus/templates/brain/app/components/layout/Sidebar.tsx +34 -101
- package/corpus/templates/brain/app/routes/sources.tsx +1 -1
- package/corpus/templates/brain/vitest.config.ts +7 -0
- package/corpus/templates/calendar/CHANGELOG.md +6 -0
- package/corpus/templates/calendar/app/pages/BookingLinksPage.tsx +1 -1
- package/corpus/templates/calendar/changelog/2026-10-16-booking-links-show-localized-visibility-badges.md +6 -0
- package/corpus/templates/chat/app/components/layout/Sidebar.tsx +62 -101
- package/corpus/templates/clips/CHANGELOG.md +7 -20
- package/corpus/templates/clips/app/components/meetings/share-meeting-dialog.tsx +20 -77
- package/corpus/templates/clips/app/components/player/share-dialog.tsx +63 -90
- package/corpus/templates/clips/app/components/sharing/share-test-support.tsx +180 -0
- package/corpus/templates/clips/app/components/sharing/share-ui.tsx +5 -584
- package/corpus/templates/clips/changelog/2026-10-16-share-dialogs-make-it-easier-to-see-who-has-access-and-manag.md +6 -0
- package/corpus/templates/clips/changelog/2026-10-21-share-panels-describe-general-access-in-a-sentence.md +6 -0
- package/corpus/templates/community/qr/package.json +1 -1
- package/corpus/templates/content/CHANGELOG.md +7 -0
- package/corpus/templates/content/app/components/editor/CommentStack.tsx +301 -0
- package/corpus/templates/content/app/components/editor/CommentsSidebar.tsx +770 -179
- package/corpus/templates/content/app/components/editor/DocumentEditor.tsx +75 -27
- package/corpus/templates/content/app/components/editor/SuggestionText.tsx +18 -3
- package/corpus/templates/content/app/components/editor/VisualEditor.tsx +89 -22
- package/corpus/templates/content/app/components/editor/block-field-comment-threads.ts +15 -0
- package/corpus/templates/content/app/components/editor/block-field-comments.tsx +5 -9
- package/corpus/templates/content/app/components/editor/comment-stacks.ts +143 -0
- package/corpus/templates/content/app/components/editor/extensions/SuggestionHighlight.ts +383 -34
- package/corpus/templates/content/app/components/editor/suggestions/draft-session.ts +31 -0
- package/corpus/templates/content/app/components/editor/suggestions/presentation-rebase.ts +82 -4
- package/corpus/templates/content/app/global.css +31 -0
- package/corpus/templates/content/app/i18n-data.ts +8 -0
- package/corpus/templates/content/changelog/2026-10-16-accepting-a-suggestion-on-a-page-that-changed-since-it-was-s.md +6 -0
- package/corpus/templates/content/changelog/2026-10-20-suggested-edits-that-add-remove-split-or-merge-paragraphs-li.md +6 -0
- package/corpus/templates/content/changelog/2026-10-22-blocks-with-several-comment-threads-fold-into-one-stack-in-t.md +6 -0
- package/corpus/templates/content/changelog/2026-10-22-opening-a-page-no-longer-saves-an-edit-again-after-another-o.md +6 -0
- package/corpus/templates/content/docs/product/capabilities/content.comment.page-owned.md +8 -1
- package/corpus/templates/content/shared/suggestion-diff.ts +23 -6
- package/corpus/templates/content/shared/suggestion-formatting.ts +44 -14
- package/corpus/templates/content/shared/suggestion-text.ts +20 -5
- package/corpus/templates/design/.generated/bridge/interact-links.generated.ts +8 -8
- package/corpus/templates/design/CHANGELOG.md +8 -0
- package/corpus/templates/design/app/components/design/DesignCanvas.tsx +18 -1
- package/corpus/templates/design/app/components/design/bridge/interact-links.bridge.ts +8 -8
- package/corpus/templates/design/app/components/editor/PromptDialog.tsx +15 -13
- package/corpus/templates/design/app/i18n/en-US.ts +1 -1
- package/corpus/templates/design/app/pages/DesignSystems.tsx +1 -1
- package/corpus/templates/design/app/pages/Index.tsx +18 -64
- package/corpus/templates/design/app/pages/design-editor/domains/use-editor-modes.ts +15 -6
- package/corpus/templates/design/app/pages/design-editor/domains/use-editor-screen-rendering.tsx +29 -5
- package/corpus/templates/design/app/pages/design-editor/prototype-navigation-transition.ts +423 -0
- package/corpus/templates/design/app/pages/design-editor/view/single-screen-canvas.tsx +35 -9
- package/corpus/templates/design/changelog/2026-10-16-design-pages-use-localized-visibility-badges-and-a-shared-ow.md +6 -0
- package/corpus/templates/design/changelog/2026-10-20-the-design-full-app-toggle-on-the-home-page-no-longer-hides-.md +6 -0
- package/corpus/templates/design/changelog/2026-10-22-prototype-links-can-play-code-authored-screen-transitions.md +6 -0
- package/corpus/templates/design/shared/motion-authored-css-import.ts +938 -7
- package/corpus/templates/design/shared/motion-html-source.ts +1689 -135
- package/corpus/templates/design/shared/motion-prototype-transition.ts +329 -0
- package/corpus/templates/design/shared/motion-react-source.ts +2154 -126
- package/corpus/templates/design/shared/motion-text-runtime-v1.fixture.txt +221 -0
- package/corpus/templates/dispatch/CHANGELOG.md +4 -0
- package/corpus/templates/dispatch/app/i18n-data.ts +75 -0
- package/corpus/templates/dispatch/changelog/2026-10-21-owned-and-shared-chats-appear-in-separate-history-sections.md +6 -0
- package/corpus/templates/factory/app/components/layout/Sidebar.tsx +34 -100
- package/corpus/templates/forms/app/pages/FormsListPage.tsx +1 -1
- package/corpus/templates/plan/CHANGELOG.md +6 -0
- package/corpus/templates/plan/app/components/layout/Sidebar.tsx +34 -109
- package/corpus/templates/plan/changelog/2026-10-16-owned-and-shared-chats-appear-in-separate-history-sections.md +6 -0
- package/corpus/templates/slides/CHANGELOG.md +1 -0
- package/corpus/templates/slides/app/components/deck/DeckCard.tsx +1 -1
- package/corpus/templates/slides/app/components/design-system/DesignSystemCard.tsx +1 -1
- package/corpus/templates/slides/app/pages/Index.tsx +7 -2
- package/corpus/templates/slides/changelog/2026-10-16-deck-lists-use-the-shared-ownership-filter-and-visibility-ba.md +6 -0
- package/package.json +1 -1
- package/corpus/templates/chat/app/lib/sidebar-thread-state.ts +0 -29
- package/corpus/templates/slides/app/components/deck/DeckFilterMenu.tsx +0 -83
|
@@ -13,6 +13,12 @@ time from the command menu (Cmd+K → "What's new").
|
|
|
13
13
|
|
|
14
14
|
- Apps no longer keep server functions and databases warm by default; set `AGENT_NATIVE_ENABLE_KEEP_WARM=1` to opt in.
|
|
15
15
|
|
|
16
|
+
## 2026-10-16
|
|
17
|
+
|
|
18
|
+
### Added
|
|
19
|
+
|
|
20
|
+
- Owned and shared chats appear in separate history sections, with each shared chat's owner shown as an avatar and a Copy link action on every chat.
|
|
21
|
+
|
|
16
22
|
## 2026-10-13
|
|
17
23
|
|
|
18
24
|
### Fixed
|
|
@@ -2,7 +2,6 @@ import {
|
|
|
2
2
|
navigateWithAgentChatViewTransition,
|
|
3
3
|
sendToAgentChat,
|
|
4
4
|
useChatThreads,
|
|
5
|
-
type ChatThreadSummary,
|
|
6
5
|
} from "@agent-native/core/client/agent-chat";
|
|
7
6
|
import { useCodeMode } from "@agent-native/core/client/agent-chat";
|
|
8
7
|
import { appPath } from "@agent-native/core/client/api-path";
|
|
@@ -10,6 +9,11 @@ import { useSession } from "@agent-native/core/client/hooks";
|
|
|
10
9
|
import { useT } from "@agent-native/core/client/i18n";
|
|
11
10
|
import { buildSignInReturnHref } from "@agent-native/core/client/sign-in-return";
|
|
12
11
|
import { useSendToAgentChat } from "@agent-native/toolkit/app/chat/composer";
|
|
12
|
+
import {
|
|
13
|
+
OwnershipChatHistoryRail,
|
|
14
|
+
useOwnershipChatHistory,
|
|
15
|
+
ownDraftRows,
|
|
16
|
+
} from "@agent-native/toolkit/app/chat/ownership-history";
|
|
13
17
|
import { DevDatabaseLink } from "@agent-native/toolkit/app/db-admin";
|
|
14
18
|
import { FeedbackButton } from "@agent-native/toolkit/app/feedback";
|
|
15
19
|
import { OrgSwitcher } from "@agent-native/toolkit/app/org";
|
|
@@ -21,10 +25,6 @@ import {
|
|
|
21
25
|
} from "@agent-native/toolkit/app/shared";
|
|
22
26
|
import { LazyChunkErrorBoundary } from "@agent-native/toolkit/app/shared";
|
|
23
27
|
import { LazyChunkRetryFallback } from "@agent-native/toolkit/app/shared";
|
|
24
|
-
import {
|
|
25
|
-
ChatHistoryRail,
|
|
26
|
-
type ChatHistoryItem,
|
|
27
|
-
} from "@agent-native/toolkit/chat-history";
|
|
28
28
|
import { planPathForKind } from "@shared/plan-routes";
|
|
29
29
|
import {
|
|
30
30
|
IconClipboardCheck,
|
|
@@ -34,14 +34,7 @@ import {
|
|
|
34
34
|
IconRefresh,
|
|
35
35
|
IconNews,
|
|
36
36
|
} from "@tabler/icons-react";
|
|
37
|
-
import {
|
|
38
|
-
lazy,
|
|
39
|
-
Suspense,
|
|
40
|
-
useEffect,
|
|
41
|
-
useMemo,
|
|
42
|
-
useState,
|
|
43
|
-
type MouseEvent,
|
|
44
|
-
} from "react";
|
|
37
|
+
import { lazy, Suspense, useMemo, useState, type MouseEvent } from "react";
|
|
45
38
|
import { Link, useLocation, useNavigate } from "react-router";
|
|
46
39
|
import { toast } from "sonner";
|
|
47
40
|
|
|
@@ -121,40 +114,6 @@ function formatPlanAge(value: string) {
|
|
|
121
114
|
});
|
|
122
115
|
}
|
|
123
116
|
|
|
124
|
-
function formatThreadAge(updatedAt: number) {
|
|
125
|
-
const diffMs = Math.max(0, Date.now() - updatedAt);
|
|
126
|
-
const minutes = Math.floor(diffMs / 60_000);
|
|
127
|
-
if (minutes < 1) return "now";
|
|
128
|
-
if (minutes < 60) return `${minutes}m`;
|
|
129
|
-
const hours = Math.floor(minutes / 60);
|
|
130
|
-
if (hours < 24) return `${hours}h`;
|
|
131
|
-
const days = Math.floor(hours / 24);
|
|
132
|
-
if (days < 7) return `${days}d`;
|
|
133
|
-
return new Date(updatedAt).toLocaleDateString([], {
|
|
134
|
-
month: "short",
|
|
135
|
-
day: "numeric",
|
|
136
|
-
});
|
|
137
|
-
}
|
|
138
|
-
|
|
139
|
-
function threadTitle(thread: ChatThreadSummary) {
|
|
140
|
-
return thread.title || thread.preview || "Untitled chat";
|
|
141
|
-
}
|
|
142
|
-
|
|
143
|
-
function threadUpdatedAt(thread: ChatThreadSummary) {
|
|
144
|
-
return Number.isFinite(thread.updatedAt)
|
|
145
|
-
? thread.updatedAt
|
|
146
|
-
: Number.isFinite(thread.createdAt)
|
|
147
|
-
? thread.createdAt
|
|
148
|
-
: 0;
|
|
149
|
-
}
|
|
150
|
-
|
|
151
|
-
function compareThreads(a: ChatThreadSummary, b: ChatThreadSummary) {
|
|
152
|
-
const aPinned = a.pinnedAt ?? 0;
|
|
153
|
-
const bPinned = b.pinnedAt ?? 0;
|
|
154
|
-
if (aPinned || bPinned) return bPinned - aPinned;
|
|
155
|
-
return threadUpdatedAt(b) - threadUpdatedAt(a);
|
|
156
|
-
}
|
|
157
|
-
|
|
158
117
|
function persistedActiveThreadId() {
|
|
159
118
|
try {
|
|
160
119
|
return localStorage.getItem(
|
|
@@ -182,53 +141,34 @@ function PlanChatsSection({
|
|
|
182
141
|
pinThread,
|
|
183
142
|
archiveThread,
|
|
184
143
|
renameThread,
|
|
185
|
-
|
|
144
|
+
isNewThread,
|
|
186
145
|
} = useChatThreads(undefined, PLAN_CHAT_STORAGE_KEY, undefined, {
|
|
146
|
+
ownership: "mine",
|
|
187
147
|
autoCreate: false,
|
|
188
148
|
restoreActiveThread: false,
|
|
189
149
|
});
|
|
190
150
|
|
|
191
|
-
const
|
|
192
|
-
() =>
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
() =>
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
);
|
|
213
|
-
|
|
214
|
-
useEffect(() => {
|
|
215
|
-
const refresh = () => refreshThreads();
|
|
216
|
-
const handleRunning = (event: Event) => {
|
|
217
|
-
const detail = (event as CustomEvent).detail as
|
|
218
|
-
| { isRunning?: unknown }
|
|
219
|
-
| undefined;
|
|
220
|
-
if (typeof detail?.isRunning === "boolean") refreshThreads();
|
|
221
|
-
};
|
|
222
|
-
|
|
223
|
-
window.addEventListener("agent-chat:threads-updated", refresh);
|
|
224
|
-
window.addEventListener("agentNative.chatRunning", handleRunning);
|
|
225
|
-
window.addEventListener("focus", refresh);
|
|
226
|
-
return () => {
|
|
227
|
-
window.removeEventListener("agent-chat:threads-updated", refresh);
|
|
228
|
-
window.removeEventListener("agentNative.chatRunning", handleRunning);
|
|
229
|
-
window.removeEventListener("focus", refresh);
|
|
230
|
-
};
|
|
231
|
-
}, [refreshThreads]);
|
|
151
|
+
const history = useOwnershipChatHistory({
|
|
152
|
+
getThreadUrl: (threadId) => appPath(planChatThreadPath(threadId)),
|
|
153
|
+
activeId: activeThreadId,
|
|
154
|
+
localMineRows: ownDraftRows({ threads, isNewThread }),
|
|
155
|
+
mutations: {
|
|
156
|
+
pin: pinThread,
|
|
157
|
+
rename: renameThread,
|
|
158
|
+
archive: archiveThread,
|
|
159
|
+
},
|
|
160
|
+
onMutationFailed: (kind) => {
|
|
161
|
+
toast.error(
|
|
162
|
+
t(
|
|
163
|
+
kind === "archive"
|
|
164
|
+
? "raw.sidebar.archiveChatFailed"
|
|
165
|
+
: kind === "rename"
|
|
166
|
+
? "raw.sidebar.renameChatFailed"
|
|
167
|
+
: "agentChat.common.saveFailed",
|
|
168
|
+
),
|
|
169
|
+
);
|
|
170
|
+
},
|
|
171
|
+
});
|
|
232
172
|
|
|
233
173
|
if (collapsed) return null;
|
|
234
174
|
|
|
@@ -252,20 +192,12 @@ function PlanChatsSection({
|
|
|
252
192
|
async function handleArchiveThread(threadId: string) {
|
|
253
193
|
const wasActive =
|
|
254
194
|
threadId === activeThreadId || threadId === persistedActiveThreadId();
|
|
255
|
-
const archived = await
|
|
256
|
-
if (!archived)
|
|
257
|
-
toast.error(t("raw.sidebar.archiveChatFailed"));
|
|
258
|
-
return;
|
|
259
|
-
}
|
|
195
|
+
const archived = await history.listProps.onDelete!(threadId);
|
|
196
|
+
if (!archived) return false;
|
|
260
197
|
if (wasActive) {
|
|
261
198
|
await handleNewChat();
|
|
262
199
|
}
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
function handleRenameThread(threadId: string, title: string) {
|
|
266
|
-
void renameThread(threadId, title).then((renamed) => {
|
|
267
|
-
if (!renamed) toast.error(t("raw.sidebar.renameChatFailed"));
|
|
268
|
-
});
|
|
200
|
+
return true;
|
|
269
201
|
}
|
|
270
202
|
|
|
271
203
|
return (
|
|
@@ -275,22 +207,15 @@ function PlanChatsSection({
|
|
|
275
207
|
aria-hidden={!open}
|
|
276
208
|
>
|
|
277
209
|
<div className="ms-4">
|
|
278
|
-
<
|
|
279
|
-
|
|
210
|
+
<OwnershipChatHistoryRail
|
|
211
|
+
{...history}
|
|
280
212
|
activeId={activeThreadId}
|
|
281
213
|
onSelect={(threadId) => openThread(threadId)}
|
|
282
214
|
onNewChat={() => void handleNewChat()}
|
|
283
215
|
railLabels={{
|
|
284
216
|
newChat: t("sidebar.newChat"),
|
|
285
|
-
showMore: t("sidebar.chats"),
|
|
286
|
-
showLess: t("sidebar.chats"),
|
|
287
217
|
}}
|
|
288
218
|
renameMaxLength={160}
|
|
289
|
-
onTogglePin={(threadId) => {
|
|
290
|
-
const thread = visibleThreads.find((item) => item.id === threadId);
|
|
291
|
-
if (thread) void pinThread(threadId, !thread.pinnedAt);
|
|
292
|
-
}}
|
|
293
|
-
onRename={handleRenameThread}
|
|
294
219
|
onDelete={(threadId) => void handleArchiveThread(threadId)}
|
|
295
220
|
labels={{
|
|
296
221
|
options: (item) => `${t("sidebar.chats")}: ${item.titleText ?? ""}`,
|
|
@@ -47,6 +47,7 @@ time from the command menu (Cmd+K → "What's new").
|
|
|
47
47
|
|
|
48
48
|
### Improved
|
|
49
49
|
|
|
50
|
+
- Deck lists use the shared ownership filter, and visibility badges use localized labels.
|
|
50
51
|
- Contextual toolbar: the second row now changes with what is selected (text, shape, image, video, multi-select), and every state ends with an Edit with Agent button with quick picks.
|
|
51
52
|
- The top bar shows a deck's privacy next to its name, Share has People and Agents tabs, and Present opens a menu to start in this tab, full screen, or Presenter View.
|
|
52
53
|
|
|
@@ -3,7 +3,7 @@ import {
|
|
|
3
3
|
CreativeContextShareSheet,
|
|
4
4
|
useCreativeContextLab,
|
|
5
5
|
} from "@agent-native/creative-context/client";
|
|
6
|
-
import { VisibilityBadge } from "@agent-native/toolkit/sharing";
|
|
6
|
+
import { VisibilityBadge } from "@agent-native/toolkit/app/sharing/VisibilityBadge";
|
|
7
7
|
import {
|
|
8
8
|
IconBuildingCommunity,
|
|
9
9
|
IconDots,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { useT } from "@agent-native/core/client/i18n";
|
|
2
2
|
import { ShareButton } from "@agent-native/toolkit/app/sharing";
|
|
3
|
-
import { VisibilityBadge } from "@agent-native/toolkit/sharing";
|
|
3
|
+
import { VisibilityBadge } from "@agent-native/toolkit/app/sharing/VisibilityBadge";
|
|
4
4
|
import {
|
|
5
5
|
IconBuildingCommunity,
|
|
6
6
|
IconComponents,
|
|
@@ -30,6 +30,7 @@ import {
|
|
|
30
30
|
LazyChunkErrorBoundary,
|
|
31
31
|
LazyChunkRetryFallback,
|
|
32
32
|
} from "@agent-native/toolkit/app/shared";
|
|
33
|
+
import { OwnershipFilter } from "@agent-native/toolkit/app/sharing/OwnershipFilter";
|
|
33
34
|
import { appStateKeyForBrowserTab } from "@shared/app-state-tabs";
|
|
34
35
|
import { extractGoogleDocUrls } from "@shared/google-docs";
|
|
35
36
|
import {
|
|
@@ -62,7 +63,6 @@ import { toast } from "sonner";
|
|
|
62
63
|
import { z } from "zod";
|
|
63
64
|
|
|
64
65
|
import DeckCard from "@/components/deck/DeckCard";
|
|
65
|
-
import { DeckFilterMenu } from "@/components/deck/DeckFilterMenu";
|
|
66
66
|
import { DeckEditorSkeleton } from "@/components/editor/DeckEditorSkeleton";
|
|
67
67
|
import { ImportDeckButton } from "@/components/editor/ImportDeckButton";
|
|
68
68
|
import {
|
|
@@ -2928,7 +2928,12 @@ export default function Index({ active = true }: { active?: boolean }) {
|
|
|
2928
2928
|
/>
|
|
2929
2929
|
}
|
|
2930
2930
|
recentActions={
|
|
2931
|
-
<
|
|
2931
|
+
<OwnershipFilter
|
|
2932
|
+
value={deckFilter === "not-mine" ? "shared" : deckFilter}
|
|
2933
|
+
onChange={(value) =>
|
|
2934
|
+
setDeckFilter(value === "shared" ? "not-mine" : value)
|
|
2935
|
+
}
|
|
2936
|
+
/>
|
|
2932
2937
|
}
|
|
2933
2938
|
templates={<DeckTemplateLibrary enabled={isHome} />}
|
|
2934
2939
|
recent={
|
package/package.json
CHANGED
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import type { ChatThreadSummary } from "@agent-native/toolkit/app/chat/agentkit-chat/index";
|
|
2
|
-
|
|
3
|
-
export function visibleChatThreads(
|
|
4
|
-
threads: ChatThreadSummary[],
|
|
5
|
-
observedThreadStarts: ReadonlyMap<string, number>,
|
|
6
|
-
): ChatThreadSummary[] {
|
|
7
|
-
const knownIds = new Set(threads.map((thread) => thread.id));
|
|
8
|
-
const optimistic: ChatThreadSummary[] = [...observedThreadStarts].flatMap(
|
|
9
|
-
([id, startedAt]) =>
|
|
10
|
-
knownIds.has(id)
|
|
11
|
-
? []
|
|
12
|
-
: [
|
|
13
|
-
{
|
|
14
|
-
id,
|
|
15
|
-
title: "",
|
|
16
|
-
preview: "",
|
|
17
|
-
messageCount: 0,
|
|
18
|
-
createdAt: startedAt,
|
|
19
|
-
updatedAt: startedAt,
|
|
20
|
-
scope: null,
|
|
21
|
-
},
|
|
22
|
-
],
|
|
23
|
-
);
|
|
24
|
-
return [...threads, ...optimistic].filter(
|
|
25
|
-
(thread) =>
|
|
26
|
-
!thread.archivedAt &&
|
|
27
|
-
(thread.messageCount > 0 || observedThreadStarts.has(thread.id)),
|
|
28
|
-
);
|
|
29
|
-
}
|
|
@@ -1,83 +0,0 @@
|
|
|
1
|
-
import { useT } from "@agent-native/core/client/i18n";
|
|
2
|
-
import { IconChevronDown } from "@tabler/icons-react";
|
|
3
|
-
|
|
4
|
-
import { Button } from "@/components/ui/button";
|
|
5
|
-
import {
|
|
6
|
-
DropdownMenu,
|
|
7
|
-
DropdownMenuContent,
|
|
8
|
-
DropdownMenuRadioGroup,
|
|
9
|
-
DropdownMenuRadioItem,
|
|
10
|
-
DropdownMenuTrigger,
|
|
11
|
-
} from "@/components/ui/dropdown-menu";
|
|
12
|
-
import type { DeckFilter } from "@/lib/deck-filter";
|
|
13
|
-
|
|
14
|
-
export function DeckFilterMenu({
|
|
15
|
-
value,
|
|
16
|
-
onChange,
|
|
17
|
-
}: {
|
|
18
|
-
value: DeckFilter;
|
|
19
|
-
onChange: (value: DeckFilter) => void;
|
|
20
|
-
}) {
|
|
21
|
-
const t = useT();
|
|
22
|
-
const optionLabels: Record<DeckFilter, string> = {
|
|
23
|
-
all: t("home.ownedByAnyone"),
|
|
24
|
-
mine: t("home.ownedByMe"),
|
|
25
|
-
"not-mine": t("home.sharedWithMe"),
|
|
26
|
-
};
|
|
27
|
-
const label = optionLabels[value];
|
|
28
|
-
return (
|
|
29
|
-
<DropdownMenu>
|
|
30
|
-
<DropdownMenuTrigger asChild>
|
|
31
|
-
<Button
|
|
32
|
-
type="button"
|
|
33
|
-
variant="outline"
|
|
34
|
-
size="sm"
|
|
35
|
-
aria-label={label}
|
|
36
|
-
className="h-9 shrink-0 gap-2"
|
|
37
|
-
>
|
|
38
|
-
<span className="grid">
|
|
39
|
-
{Object.entries(optionLabels).map(([filter, option]) => (
|
|
40
|
-
<span
|
|
41
|
-
key={filter}
|
|
42
|
-
aria-hidden="true"
|
|
43
|
-
className="invisible col-start-1 row-start-1 whitespace-nowrap"
|
|
44
|
-
>
|
|
45
|
-
{option}
|
|
46
|
-
</span>
|
|
47
|
-
))}
|
|
48
|
-
<span className="col-start-1 row-start-1 whitespace-nowrap">
|
|
49
|
-
{label}
|
|
50
|
-
</span>
|
|
51
|
-
</span>
|
|
52
|
-
<IconChevronDown className="size-4" aria-hidden="true" />
|
|
53
|
-
</Button>
|
|
54
|
-
</DropdownMenuTrigger>
|
|
55
|
-
<DropdownMenuContent align="start">
|
|
56
|
-
<DropdownMenuRadioGroup
|
|
57
|
-
value={value}
|
|
58
|
-
onValueChange={(nextValue) => {
|
|
59
|
-
if (
|
|
60
|
-
nextValue === "mine" ||
|
|
61
|
-
nextValue === "all" ||
|
|
62
|
-
nextValue === "not-mine"
|
|
63
|
-
) {
|
|
64
|
-
onChange(nextValue);
|
|
65
|
-
}
|
|
66
|
-
}}
|
|
67
|
-
>
|
|
68
|
-
<DropdownMenuRadioItem value="all" indicator="check">
|
|
69
|
-
{t("home.ownedByAnyone")}
|
|
70
|
-
</DropdownMenuRadioItem>
|
|
71
|
-
<DropdownMenuRadioItem value="mine" indicator="check">
|
|
72
|
-
{t("home.ownedByMe")}
|
|
73
|
-
</DropdownMenuRadioItem>
|
|
74
|
-
<DropdownMenuRadioItem value="not-mine" indicator="check">
|
|
75
|
-
{t("home.sharedWithMe")}
|
|
76
|
-
</DropdownMenuRadioItem>
|
|
77
|
-
</DropdownMenuRadioGroup>
|
|
78
|
-
</DropdownMenuContent>
|
|
79
|
-
</DropdownMenu>
|
|
80
|
-
);
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
export default DeckFilterMenu;
|