refactor(clues): restyle the detail, pack, collect and share windows
The clue windows kept redundant title inputs, bare radios and file pickers and doubled footer borders. They now sit on the shared ListRow, SearchField and Disclosure patterns with compact action footers, while the Feishu preview follows the same density. Generated with [Devin](https://devin.ai) Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
This commit is contained in:
1 parent
de90a883a3
commit
1ddabbc227
13 files changed
+453
-387
No files matched your search
@@ -28,7 +28,7 @@ import {
|
||||
import { TextDocumentContent } from '../../../windows/format-content.tsx'
|
||||
import { MdToc } from '../../../md-toc.tsx'
|
||||
import { t } from '../../../locales.ts'
|
||||
import { ActionButton, ActionFooter, Field, TextArea, TextInput } from '../../../ui/index.ts'
|
||||
import { ActionButton, ActionFooter, Disclosure, Field, TextArea, TextInput } from '../../../ui/index.ts'
|
||||
import css from './feishu.module.css'
|
||||
import type { FeishuClientLabels } from './labels.ts'
|
||||
import { appDateTime } from './time.ts'
|
||||
@@ -311,12 +311,11 @@ function ReadPreview(props: {
|
||||
)}
|
||||
</div>
|
||||
{content !== '' && (
|
||||
<details className={css.rawDetails} data-feishu-docs-raw="">
|
||||
<summary>{t('clueResourceDetails')}</summary>
|
||||
<Disclosure className={css.rawDetails} data-feishu-docs-raw="" summary={t('clueResourceDetails')}>
|
||||
<pre className={css.pre} id={`${prefix}-content`} data-feishu-docs-content="">
|
||||
{content}
|
||||
</pre>
|
||||
</details>
|
||||
</Disclosure>
|
||||
)}
|
||||
{collapsible && (
|
||||
<p className={css.hint} data-feishu-docs-truncated="">
|
||||
|
||||
@@ -12,8 +12,7 @@
|
||||
min-width: 0;
|
||||
padding: var(--ds-sidebar-gutter);
|
||||
color: var(--dsw-alias-label-primary);
|
||||
background: var(--dsw-alias-bg-layer-1);
|
||||
|
||||
background: transparent;
|
||||
}
|
||||
|
||||
.meta {
|
||||
@@ -196,21 +195,11 @@
|
||||
}
|
||||
|
||||
.rawDetails {
|
||||
margin-top: 2px;
|
||||
margin-top: 4px;
|
||||
color: var(--dsw-alias-label-tertiary);
|
||||
font-size: 11px;
|
||||
}
|
||||
|
||||
.rawDetails > summary {
|
||||
min-height: var(--ds-sidebar-control-height);
|
||||
padding: 2px 0;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.rawDetails[open] > summary {
|
||||
margin-bottom: 4px;
|
||||
}
|
||||
|
||||
/* Embedded task body: the shared header already carries title/people/times. */
|
||||
.bodyRow {
|
||||
display: flex;
|
||||
@@ -225,7 +214,7 @@
|
||||
|
||||
/* Keep the source heading hierarchy visible as well as semantic for MdToc. */
|
||||
.docHeading { margin-block-start: 8px; }
|
||||
h1.docHeading { font-size: 20px; }
|
||||
h2.docHeading { font-size: 18px; }
|
||||
h3.docHeading { font-size: 16px; }
|
||||
h1.docHeading { font-size: 16px; line-height: 24px; }
|
||||
h2.docHeading { font-size: 15px; line-height: 22px; }
|
||||
h3.docHeading { font-size: 14px; line-height: 20px; }
|
||||
h5.docHeading, h6.docHeading, .docHeading[aria-level] { font-size: 13px; }
|
||||
@@ -13,16 +13,15 @@
|
||||
color: var(--dsw-alias-label-primary);
|
||||
}
|
||||
.selection { flex: none; min-width: 0; }
|
||||
.selection > summary { cursor: pointer; min-height: var(--ds-sidebar-control-height); align-content: center; }
|
||||
.selection > summary:focus-visible { outline: 2px solid var(--dsw-alias-brand-primary); outline-offset: 1px; }
|
||||
.selectionTitle { margin-inline-start: 8px; color: var(--dsw-alias-label-primary); overflow-wrap: anywhere; }
|
||||
.selectionList { max-height: 96px; overflow: auto; margin: 4px 0 0; padding-inline-start: 20px; color: var(--dsw-alias-label-secondary); overflow-wrap: anywhere; }
|
||||
.selectionList { max-height: 88px; overflow: auto; margin: 2px 0 0; padding-inline-start: 18px; color: var(--dsw-alias-label-secondary); overflow-wrap: anywhere; }
|
||||
.count {
|
||||
flex: none;
|
||||
margin: 0;
|
||||
color: var(--dsw-alias-label-tertiary);
|
||||
font-size: 12px;
|
||||
line-height: 18px;
|
||||
font-variant-numeric: tabular-nums;
|
||||
}
|
||||
.form {
|
||||
display: flex;
|
||||
@@ -36,38 +35,25 @@
|
||||
display: flex;
|
||||
flex: 1;
|
||||
flex-direction: column;
|
||||
gap: var(--ds-sidebar-space-3);
|
||||
gap: var(--ds-sidebar-space-2);
|
||||
min-width: 0;
|
||||
min-height: 0;
|
||||
overflow: auto;
|
||||
overscroll-behavior: contain;
|
||||
scrollbar-width: thin;
|
||||
}
|
||||
.searchBox {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
flex: 1;
|
||||
gap: var(--ds-sidebar-space-2);
|
||||
min-width: 0;
|
||||
color: var(--dsw-alias-label-tertiary);
|
||||
}
|
||||
.searchBox > svg {
|
||||
flex: none;
|
||||
}
|
||||
.searchInput {
|
||||
flex: 1;
|
||||
flex: none;
|
||||
width: 100%;
|
||||
min-width: 0;
|
||||
}
|
||||
|
||||
|
||||
.destinationList {
|
||||
display: flex;
|
||||
flex: 1 1 112px;
|
||||
flex: 1 1 96px;
|
||||
flex-direction: column;
|
||||
gap: var(--ds-sidebar-space-1);
|
||||
gap: 0;
|
||||
min-width: 0;
|
||||
min-height: 36px;
|
||||
min-height: 32px;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
border: 0;
|
||||
@@ -79,12 +65,13 @@
|
||||
opacity: 0.4;
|
||||
}
|
||||
.destinationRow {
|
||||
position: relative;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
flex: none;
|
||||
gap: var(--ds-sidebar-space-2);
|
||||
min-width: 0;
|
||||
min-height: 36px;
|
||||
min-height: 32px;
|
||||
padding: 4px 8px;
|
||||
box-sizing: border-box;
|
||||
border-radius: var(--ds-sidebar-radius);
|
||||
@@ -97,20 +84,27 @@
|
||||
.destinationRow:has(input:checked) {
|
||||
background: var(--dsw-alias-interactive-bg-active);
|
||||
}
|
||||
.destinationRow input {
|
||||
flex: none;
|
||||
accent-color: var(--dsw-alias-state-business-primary, var(--dsw-alias-label-secondary));
|
||||
.destinationInput {
|
||||
position: absolute;
|
||||
inset: 0;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
margin: 0;
|
||||
opacity: 0;
|
||||
cursor: inherit;
|
||||
}
|
||||
.destinationRow:has(input:focus-visible) {
|
||||
outline: 2px solid var(--dsw-alias-brand-primary);
|
||||
outline-offset: -2px;
|
||||
}
|
||||
.destinationRow > span:not([data-clue-artwork]) {
|
||||
.destinationName {
|
||||
display: -webkit-box;
|
||||
-webkit-box-orient: vertical;
|
||||
-webkit-line-clamp: 2;
|
||||
flex: 1;
|
||||
flex: 1 1 auto;
|
||||
min-width: 0;
|
||||
font-size: 13px;
|
||||
line-height: 18px;
|
||||
overflow: hidden;
|
||||
overflow-wrap: anywhere;
|
||||
}
|
||||
@@ -120,7 +114,19 @@
|
||||
font-size: 11px;
|
||||
font-variant-numeric: tabular-nums;
|
||||
}
|
||||
.destinationCheck {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
flex: none;
|
||||
width: 14px;
|
||||
color: var(--dsw-alias-state-business-primary, var(--dsw-alias-label-primary));
|
||||
visibility: hidden;
|
||||
}
|
||||
.destinationRow:has(input:checked) .destinationCheck {
|
||||
visibility: visible;
|
||||
}
|
||||
.hint {
|
||||
padding: 4px 8px;
|
||||
color: var(--dsw-alias-label-tertiary);
|
||||
font-size: 11px;
|
||||
line-height: 16px;
|
||||
|
||||
@@ -31,8 +31,8 @@
|
||||
import { useCallback, useEffect, useId, useMemo, useRef, useState } from 'react'
|
||||
import type { ReactNode } from 'react'
|
||||
import {
|
||||
IconCheckOutlineRegular,
|
||||
IconPlusOutlineRegular,
|
||||
IconSearchOutlineRegular,
|
||||
} from '@deepseek-ai/dsh-client-ui-primitives'
|
||||
import type { ClueCandidate, CluePack, CluesPacksResult } from '../../../clues/types.ts'
|
||||
import type { BetterSidebarCluesClientFace } from '../registry.ts'
|
||||
@@ -43,7 +43,7 @@ import { cluesApi, peekClueRequest } from '../api.ts'
|
||||
import { clueErrorMessage } from '../copy.ts'
|
||||
import { CluePackArtwork } from '../artwork.tsx'
|
||||
import { LoadingIndicator } from '../../ui/LoadingIndicator.tsx'
|
||||
import { ActionButton, ActionFooter, ErrorBlock, Field, TextInput } from '../../ui/index.ts'
|
||||
import { ActionButton, ActionFooter, Disclosure, ErrorBlock, Field, SearchField, TextInput } from '../../ui/index.ts'
|
||||
import { t } from '../../locales.ts'
|
||||
import css from './collect.module.css'
|
||||
|
||||
@@ -156,7 +156,7 @@ export function openClueCollectionWindow(
|
||||
const guard: ClueCollectGuard = { busy: false }
|
||||
const handle = options.windows.open({
|
||||
id: collectWindowId(options.workspaceId, options.targets),
|
||||
surface: 'sidebar',
|
||||
surface: 'floating',
|
||||
title: t('clueBrowserAddToPack'),
|
||||
size: 'compact',
|
||||
bodyLayout: 'fill',
|
||||
@@ -389,15 +389,20 @@ export function ClueCollectPage(
|
||||
|
||||
return (
|
||||
<div className={css.root}>
|
||||
<details className={css.selection} data-clue-collection-selection>
|
||||
<summary className={css.count}>
|
||||
<span aria-live="polite">{t('clueBrowserSelected', { n: pending.length })}</span>
|
||||
{pending.length === 1 && <span className={css.selectionTitle}>{pending[0]!.title}</span>}
|
||||
</summary>
|
||||
<Disclosure
|
||||
className={css.selection}
|
||||
data-clue-collection-selection
|
||||
summary={(
|
||||
<span className={css.count}>
|
||||
<span aria-live="polite">{t('clueBrowserSelected', { n: pending.length })}</span>
|
||||
{pending.length === 1 && <span className={css.selectionTitle}>{pending[0]!.title}</span>}
|
||||
</span>
|
||||
)}
|
||||
>
|
||||
<ul className={css.selectionList}>
|
||||
{pending.map(target => <li key={candidateKey(target)}>{target.title}</li>)}
|
||||
</ul>
|
||||
</details>
|
||||
</Disclosure>
|
||||
<form
|
||||
className={css.form}
|
||||
data-clue-collection
|
||||
@@ -405,19 +410,16 @@ export function ClueCollectPage(
|
||||
onSubmit={(event) => { event.preventDefault(); void submit() }}
|
||||
>
|
||||
<div className={css.fields}>
|
||||
<label className={css.searchBox}>
|
||||
<IconSearchOutlineRegular size={14} />
|
||||
<TextInput
|
||||
autoFocus
|
||||
type="search"
|
||||
className={css.searchInput}
|
||||
aria-label={t('cluePacksSearchPlaceholder')}
|
||||
placeholder={t('cluePacksSearchPlaceholder')}
|
||||
value={query}
|
||||
disabled={busy}
|
||||
onChange={(event) => { setQuery(event.target.value) }}
|
||||
/>
|
||||
</label>
|
||||
<SearchField
|
||||
autoFocus
|
||||
type="search"
|
||||
className={css.searchInput}
|
||||
aria-label={t('cluePacksSearchPlaceholder')}
|
||||
placeholder={t('cluePacksSearchPlaceholder')}
|
||||
value={query}
|
||||
disabled={busy}
|
||||
onChange={(event) => { setQuery(event.target.value) }}
|
||||
/>
|
||||
<fieldset className={css.destinationList} disabled={busy} aria-label={t('clueBrowserAddToPack')}>
|
||||
{packsPhase === 'loading' && <LoadingIndicator className={css.hint} inline />}
|
||||
{packsPhase === 'error' && (
|
||||
@@ -431,6 +433,7 @@ export function ClueCollectPage(
|
||||
{matchingPacks.map(pack => (
|
||||
<label key={pack.id} className={css.destinationRow} title={pack.name}>
|
||||
<input
|
||||
className={css.destinationInput}
|
||||
type="radio"
|
||||
name={name}
|
||||
value={pack.id}
|
||||
@@ -438,8 +441,11 @@ export function ClueCollectPage(
|
||||
onChange={() => { setDestination(pack.id) }}
|
||||
/>
|
||||
<CluePackArtwork size={16} />
|
||||
<span>{pack.name}</span>
|
||||
<span className={css.destinationName}>{pack.name}</span>
|
||||
<small>{t('cluePacksMembers', { n: pack.members.length })}</small>
|
||||
<span className={css.destinationCheck} aria-hidden="true">
|
||||
<IconCheckOutlineRegular size={14} />
|
||||
</span>
|
||||
</label>
|
||||
))}
|
||||
{packsPhase === 'ready' && matchingPacks.length === 0 && (
|
||||
@@ -449,6 +455,7 @@ export function ClueCollectPage(
|
||||
)}
|
||||
<label className={css.destinationRow}>
|
||||
<input
|
||||
className={css.destinationInput}
|
||||
type="radio"
|
||||
name={name}
|
||||
value="__new"
|
||||
@@ -456,7 +463,10 @@ export function ClueCollectPage(
|
||||
onChange={() => { setDestination('__new') }}
|
||||
/>
|
||||
<IconPlusOutlineRegular size={16} />
|
||||
<span>{t('cluePacksNew')}</span>
|
||||
<span className={css.destinationName}>{t('cluePacksNew')}</span>
|
||||
<span className={css.destinationCheck} aria-hidden="true">
|
||||
<IconCheckOutlineRegular size={14} />
|
||||
</span>
|
||||
</label>
|
||||
</fieldset>
|
||||
{destination === '__new' && (
|
||||
@@ -476,8 +486,8 @@ export function ClueCollectPage(
|
||||
bleed
|
||||
start={<span data-clue-collection-destination>{destinationName ?? t('clueSharePacks')}</span>}
|
||||
end={<>
|
||||
<ActionButton disabled={busy} onClick={cancel}>{t('cancel')}</ActionButton>
|
||||
<ActionButton type="submit" variant="primary" busy={busy} disabled={pending.length === 0 || destination === ''}>
|
||||
<ActionButton size="sm" disabled={busy} onClick={cancel}>{t('cancel')}</ActionButton>
|
||||
<ActionButton size="sm" type="submit" variant="primary" busy={busy} disabled={pending.length === 0 || destination === ''}>
|
||||
{submitLabel}
|
||||
</ActionButton>
|
||||
</>}
|
||||
|
||||
@@ -1,14 +1,16 @@
|
||||
.discussion { flex: none; min-width: 0; padding: var(--ds-sidebar-gutter); border-top: 1px solid var(--dsw-alias-border-l1); color: var(--dsw-alias-label-primary); background: var(--dsw-alias-bg-layer-1); font-size: 13px; line-height: 1.6; }
|
||||
.heading { display: flex; flex-wrap: wrap; gap: 8px; align-items: baseline; margin-bottom: 12px; }
|
||||
.heading h2 { margin: 0; font-size: 14px; font-weight: 600; }
|
||||
.hint, .meta { color: var(--dsw-alias-label-tertiary); font-size: 11px; overflow-wrap: anywhere; }
|
||||
.comment { padding: 12px 0; border-top: 1px solid var(--dsw-alias-border-l1); }
|
||||
.comment[data-clue-reply-to] { margin-inline-start: 16px; padding-inline-start: 12px; border-inline-start: 1px solid var(--dsw-alias-border-l1); }
|
||||
.meta, .actions, .replyContext { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
|
||||
.meta strong { color: var(--dsw-alias-label-secondary); }
|
||||
.meta a { color: inherit; }
|
||||
.state { border: 1px solid var(--dsw-alias-border-l1); border-radius: var(--ds-sidebar-radius); padding: 0 6px; color: var(--dsw-alias-label-secondary); }
|
||||
.body { margin: 6px 0; white-space: pre-wrap; overflow-wrap: anywhere; }
|
||||
.composer { display: flex; flex-direction: column; gap: 8px; margin-top: 16px; }
|
||||
.composer textarea { width: 100%; min-height: 72px; }
|
||||
.discussion { flex: none; min-width: 0; padding: var(--ds-sidebar-gutter); border-top: 1px solid var(--dsw-alias-border-l1); color: var(--dsw-alias-label-primary); background: transparent; font-size: 13px; line-height: 1.55; }
|
||||
.heading { display: flex; flex-wrap: wrap; gap: 8px; align-items: baseline; margin-bottom: 8px; }
|
||||
.heading h2 { margin: 0; font-size: 12px; line-height: 18px; font-weight: 500; color: var(--dsw-alias-label-secondary); font-variant-numeric: tabular-nums; }
|
||||
.hint, .meta { color: var(--dsw-alias-label-tertiary); font-size: 11px; line-height: 16px; overflow-wrap: anywhere; }
|
||||
.comment { padding: 10px 0; border-top: 1px solid var(--dsw-alias-border-l1); }
|
||||
.comment[data-clue-reply-to] { margin-inline-start: 12px; padding-inline-start: 10px; border-inline-start: 1px solid var(--dsw-alias-border-l2); }
|
||||
.meta, .actions, .replyContext { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
|
||||
.meta strong { color: var(--dsw-alias-label-primary); font-weight: 500; }
|
||||
.meta a { color: var(--dsw-alias-label-tertiary); text-decoration: none; }
|
||||
.meta a:hover { color: var(--dsw-alias-label-primary); text-decoration: underline; }
|
||||
.state { border: 1px solid var(--dsw-alias-border-l1); border-radius: var(--ds-sidebar-radius); padding: 0 5px; color: var(--dsw-alias-label-tertiary); font-size: 11px; }
|
||||
.body { margin: 4px 0; white-space: pre-wrap; overflow-wrap: anywhere; }
|
||||
.composer { display: flex; flex-direction: column; gap: 6px; margin-top: 12px; padding-top: 10px; border-top: 1px solid var(--dsw-alias-border-l1); }
|
||||
.composerLabel { font-size: 12px; font-weight: 500; color: var(--dsw-alias-label-secondary); }
|
||||
.composer textarea { width: 100%; min-height: 68px; }
|
||||
.composer .actions { justify-content: flex-end; }
|
||||
@@ -119,8 +119,8 @@ export function ResourceDiscussion(props: ResourceDiscussionProps): ReactNode {
|
||||
{comment.replyToId !== undefined && <div className={css.hint}>{copy('clueCommentReplyTo')} {personLabel(authors.get(comment.replyToId)) ?? comment.replyToId}</div>}
|
||||
{props.selectionTarget === undefined ? body : <ResourceSelectionActions {...props.selectionTarget} comment>{body}</ResourceSelectionActions>}
|
||||
<div className={css.actions}>
|
||||
{canReply && <ActionButton type="button" disabled={sending} onClick={() => { setReply(comment); document.getElementById(inputId)?.focus() }} data-clue-comment-reply={comment.id}>{copy('clueCommentReply')}</ActionButton>}
|
||||
{comment.nextRepliesCursor !== undefined && <ActionButton type="button" disabled={loading} data-clue-comment-replies={comment.id} onClick={() => { props.onLoad(comment.nextRepliesCursor, comment.id) }}>{copy('clueCommentMoreReplies')}</ActionButton>}
|
||||
{canReply && <ActionButton size="sm" variant="ghost" type="button" disabled={sending} onClick={() => { setReply(comment); document.getElementById(inputId)?.focus() }} data-clue-comment-reply={comment.id}>{copy('clueCommentReply')}</ActionButton>}
|
||||
{comment.nextRepliesCursor !== undefined && <ActionButton size="sm" variant="ghost" type="button" disabled={loading} data-clue-comment-replies={comment.id} onClick={() => { props.onLoad(comment.nextRepliesCursor, comment.id) }}>{copy('clueCommentMoreReplies')}</ActionButton>}
|
||||
</div>
|
||||
</article>
|
||||
})}
|
||||
@@ -134,13 +134,13 @@ export function ResourceDiscussion(props: ResourceDiscussionProps): ReactNode {
|
||||
onRetry={() => { props.onLoad() }}
|
||||
/>
|
||||
)}
|
||||
{page?.nextCursor !== undefined && <ActionButton type="button" disabled={loading} data-clue-comments-more onClick={() => { props.onLoad(page.nextCursor) }}>{copy('clueDiscussionMore')}</ActionButton>}
|
||||
{page?.nextCursor !== undefined && <ActionButton size="sm" type="button" disabled={loading} data-clue-comments-more onClick={() => { props.onLoad(page.nextCursor) }}>{copy('clueDiscussionMore')}</ActionButton>}
|
||||
{canCreate && <form className={css.composer} onSubmit={event => { event.preventDefault(); void submit() }}>
|
||||
<label htmlFor={inputId}>{copy(reply === undefined ? 'clueCommentWrite' : 'clueCommentReply')}</label>
|
||||
{reply !== undefined && <div className={css.replyContext}><span>{copy('clueCommentReplyTo')} {personLabel(reply.author) ?? reply.id}{capabilities?.reply === 'quote' ? ` · ${copy('clueCommentQuoteReply')}` : ''}</span><ActionButton type="button" disabled={sending} onClick={() => { setReply(undefined) }}>{t('cancel')}</ActionButton></div>}
|
||||
<label className={css.composerLabel} htmlFor={inputId}>{copy(reply === undefined ? 'clueCommentWrite' : 'clueCommentReply')}</label>
|
||||
{reply !== undefined && <div className={css.replyContext}><span>{copy('clueCommentReplyTo')} {personLabel(reply.author) ?? reply.id}{capabilities?.reply === 'quote' ? ` · ${copy('clueCommentQuoteReply')}` : ''}</span><ActionButton size="sm" variant="ghost" type="button" disabled={sending} onClick={() => { setReply(undefined) }}>{t('cancel')}</ActionButton></div>}
|
||||
<TextArea id={inputId} rows={3} value={draft} disabled={sending} onChange={event => { setDraft(event.target.value) }} data-clue-comment-input />
|
||||
{sendError !== undefined && <Notice kind="error" tone="inline">{sendError}</Notice>}
|
||||
<div className={css.actions}><ActionButton type="submit" busy={sending} disabled={draft.trim() === ''} data-clue-comment-submit>{copy('clueCommentPost')}</ActionButton></div>
|
||||
<div className={css.actions}><ActionButton size="sm" variant="primary" type="submit" busy={sending} disabled={draft.trim() === ''} data-clue-comment-submit>{copy('clueCommentPost')}</ActionButton></div>
|
||||
</form>}
|
||||
</section>
|
||||
}
|
||||
@@ -69,7 +69,7 @@ export function openCreatePackWindow(options: OpenCreatePackWindowOptions): Wind
|
||||
const guard: CreatePackGuard = { busy: false }
|
||||
const handle = options.windows.open({
|
||||
id: createPackWindowId(options.workspaceId),
|
||||
surface: 'sidebar',
|
||||
surface: 'floating',
|
||||
title: title(),
|
||||
size: 'compact',
|
||||
bodyLayout: 'fill',
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
*/
|
||||
|
||||
.status {
|
||||
background: var(--dsw-alias-bg-layer-1);
|
||||
background: transparent;
|
||||
padding: var(--ds-sidebar-gutter);
|
||||
color: var(--dsw-alias-label-tertiary);
|
||||
font-size: 12px;
|
||||
@@ -26,7 +26,7 @@
|
||||
}
|
||||
|
||||
.action {
|
||||
composes: button from "../../ui/kit.module.css";
|
||||
composes: button buttonSm from "../../ui/kit.module.css";
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
@@ -107,26 +107,10 @@
|
||||
|
||||
/* Binding is an explicit secondary disclosure; the primary footer stays small. */
|
||||
.bindingDetails {
|
||||
flex: 1 1 180px;
|
||||
flex: 1 1 160px;
|
||||
min-width: 0;
|
||||
color: var(--dsw-alias-label-secondary);
|
||||
}
|
||||
.bindingDetails > summary {
|
||||
box-sizing: border-box;
|
||||
min-height: var(--ds-sidebar-control-height);
|
||||
padding: 4px 0;
|
||||
cursor: pointer;
|
||||
}
|
||||
.bindingDetails > summary:focus-visible {
|
||||
outline: 2px solid var(--dsw-alias-state-business-primary);
|
||||
outline-offset: 1px;
|
||||
}
|
||||
.bindingDetails[open] > .binding {
|
||||
margin-top: 6px;
|
||||
}
|
||||
@media (pointer: coarse) {
|
||||
.bindingDetails > summary { min-height: 44px; }
|
||||
}
|
||||
|
||||
/* ── Unified detail chrome (S9 refresh) ─────────────────────────────────── */
|
||||
|
||||
@@ -138,7 +122,7 @@
|
||||
min-height: 0;
|
||||
overflow-y: auto;
|
||||
overscroll-behavior: contain;
|
||||
background: var(--dsw-alias-bg-layer-1);
|
||||
background: var(--dsw-alias-bg-base);
|
||||
}
|
||||
|
||||
/* Resource actions sit at the end of the header's metadata block: Refresh is
|
||||
@@ -152,17 +136,16 @@
|
||||
|
||||
/* The original-source link is the header's one text action. */
|
||||
.sourceLink {
|
||||
composes: button from "../../ui/kit.module.css";
|
||||
composes: button buttonSm from "../../ui/kit.module.css";
|
||||
gap: 4px;
|
||||
text-decoration: none;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
|
||||
/* The footer remains useful at narrow widths and touch sizes. */
|
||||
.footer { box-sizing: border-box; min-height: 44px; align-items: center; padding-block: 4px; }
|
||||
.footerActions { justify-content: flex-end; }
|
||||
.footerActions > .action { min-height: 32px; gap: 6px; }
|
||||
.continuation { padding: 12px var(--ds-sidebar-gutter); border-top: 1px solid var(--dsw-alias-border-l1); color: var(--dsw-alias-label-secondary); }
|
||||
.footer { box-sizing: border-box; min-height: 36px; align-items: center; padding-block: 0; }
|
||||
.footerActions { justify-content: flex-end; gap: 6px; }
|
||||
.continuation { padding: 10px var(--ds-sidebar-gutter); border-top: 1px solid var(--dsw-alias-border-l1); color: var(--dsw-alias-label-secondary); }
|
||||
.continuation [role=alert] { margin-bottom: 8px; color: var(--dsw-alias-state-error-primary); }
|
||||
@media (max-width: 480px) {
|
||||
.bindingDetails { flex-basis: 100%; }
|
||||
|
||||
@@ -35,9 +35,9 @@
|
||||
*/
|
||||
import { createElement, useCallback, useEffect, useRef, useState, useSyncExternalStore } from 'react'
|
||||
import type { ReactNode } from 'react'
|
||||
import { IconRefreshOutlineRegular } from '@deepseek-ai/dsh-client-ui-primitives'
|
||||
import { IconRefreshOutlineRegular, IconRightUpOutlineRegular } from '@deepseek-ai/dsh-client-ui-primitives'
|
||||
import { ActionButton, IconButton } from '../../ui/kit.tsx'
|
||||
import { ErrorBlock } from '../../ui/patterns.tsx'
|
||||
import { Disclosure, ErrorBlock } from '../../ui/patterns.tsx'
|
||||
import type { WindowDocumentContent, WindowHandle } from '../../windows/types.ts'
|
||||
import type { BetterSidebarWindowsClientFace } from '../../windows/types.ts'
|
||||
import type {
|
||||
@@ -61,6 +61,7 @@ import * as clueApiModule from '../api.ts'
|
||||
import type { ClueWorkspaceChoice } from '../workspace-id.ts'
|
||||
import type { BetterSidebarCluesClientFace } from '../registry.ts'
|
||||
import { categoryOf, clueErrorMessage, clueErrorHint } from '../copy.ts'
|
||||
import { preferredClueWindowSurface, type ClueWindowSurface } from '../../prefs.ts'
|
||||
import { t } from '../../locales.ts'
|
||||
import { supportsWindowEditing } from '../../windows/format-content.tsx'
|
||||
import { SelectMenu } from '../../ui/SelectMenu.tsx'
|
||||
@@ -143,6 +144,7 @@ interface ClueDetailWindowOptions {
|
||||
readonly workspaceId: string
|
||||
readonly target: ClueDetailTarget
|
||||
readonly sessionId?: string
|
||||
readonly surface?: ClueWindowSurface
|
||||
/** Explicit workspaces the binding panel can offer (never guessed). */
|
||||
readonly workspaces?: readonly ClueWorkspaceChoice[]
|
||||
/** Test/integration seam for the shared synchronous read cache. */
|
||||
@@ -948,6 +950,7 @@ function createDetailController(options: ClueDetailWindowOptions): DetailControl
|
||||
'div',
|
||||
{ className: css.headerActions, 'data-clue-detail-toolbar': '' },
|
||||
createElement(IconButton, {
|
||||
size: 'sm',
|
||||
icon: state.refreshing
|
||||
? createElement(LoadingIndicator, { inline: true, size: 14, label: t('clueResourceRefreshing') })
|
||||
: createElement(IconRefreshOutlineRegular, { size: 14 }),
|
||||
@@ -969,7 +972,7 @@ function createDetailController(options: ClueDetailWindowOptions): DetailControl
|
||||
href: sourceUrl,
|
||||
target: '_blank',
|
||||
rel: 'noreferrer',
|
||||
}, t('clueDetailOpenSource')),
|
||||
}, createElement(IconRightUpOutlineRegular, { size: 12 }), t('clueDetailOpenSource')),
|
||||
)
|
||||
}
|
||||
|
||||
@@ -990,12 +993,12 @@ function createDetailController(options: ClueDetailWindowOptions): DetailControl
|
||||
{ className: css.footer, 'data-clue-detail-footer': '', 'aria-busy': referenceBusy || currentEdit?.saving === true },
|
||||
target.clueId === undefined
|
||||
? null
|
||||
: createElement('details', {
|
||||
: createElement(Disclosure, {
|
||||
className: css.bindingDetails,
|
||||
summary: t('cluePackBindingHeading'),
|
||||
'data-clue-detail-advanced': '',
|
||||
'data-clue-binding-revision': String(bindingsRevision),
|
||||
},
|
||||
createElement('summary', null, t('cluePackBindingHeading')),
|
||||
createElement(ClueBindingPanel, {
|
||||
key: `clue-binding:${target.clueId}:${bindingsRevision}`,
|
||||
face,
|
||||
@@ -1011,6 +1014,7 @@ function createDetailController(options: ClueDetailWindowOptions): DetailControl
|
||||
: createElement(
|
||||
ActionButton,
|
||||
{
|
||||
size: 'sm',
|
||||
disabled: currentEdit?.saving === true,
|
||||
onClick: () => {
|
||||
// Explicit discard: the ONLY path that drops the draft.
|
||||
@@ -1024,7 +1028,7 @@ function createDetailController(options: ClueDetailWindowOptions): DetailControl
|
||||
currentEdit !== null && (state.conflict || state.authBlocked)
|
||||
? createElement(
|
||||
ActionButton,
|
||||
{ 'data-clue-detail-reread': '', onClick: () => { void reloadEdit() } },
|
||||
{ size: 'sm', 'data-clue-detail-reread': '', onClick: () => { void reloadEdit() } },
|
||||
t('clueDetailReload'),
|
||||
)
|
||||
: null,
|
||||
@@ -1037,6 +1041,7 @@ function createDetailController(options: ClueDetailWindowOptions): DetailControl
|
||||
: createElement(
|
||||
ActionButton,
|
||||
{
|
||||
size: 'sm',
|
||||
variant: 'primary',
|
||||
'data-clue-detail-save': '',
|
||||
disabled: currentEdit.saving || !formatEditable,
|
||||
@@ -1051,6 +1056,7 @@ function createDetailController(options: ClueDetailWindowOptions): DetailControl
|
||||
: createElement(
|
||||
ActionButton,
|
||||
{
|
||||
size: 'sm',
|
||||
'data-clue-detail-add-to-pack': '',
|
||||
disabled: referenceBusy || (target.clueId === undefined && state.read === null),
|
||||
onClick: () => {
|
||||
@@ -1073,6 +1079,7 @@ function createDetailController(options: ClueDetailWindowOptions): DetailControl
|
||||
: createElement(
|
||||
ActionButton,
|
||||
{
|
||||
size: 'sm',
|
||||
variant: currentEdit?.dirty === true && formatEditable ? 'outline' : 'primary',
|
||||
'data-clue-detail-insert': '',
|
||||
disabled: referenceBusy || (target.clueId === undefined && state.read === null),
|
||||
@@ -1625,7 +1632,7 @@ export function openClueDetailWindow(options: ClueDetailWindowOptions): WindowHa
|
||||
const handle = windows.open({
|
||||
id,
|
||||
...(options.sessionId === undefined ? {} : { sessionId: options.sessionId }),
|
||||
surface: 'sidebar',
|
||||
surface: options.surface ?? preferredClueWindowSurface(),
|
||||
title: controller.initialTitle,
|
||||
size: 'document',
|
||||
bodyLayout: 'fill',
|
||||
|
||||
@@ -26,37 +26,44 @@
|
||||
}
|
||||
.head {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
flex-wrap: nowrap;
|
||||
align-items: center;
|
||||
gap: var(--ds-sidebar-space-2);
|
||||
padding-bottom: 8px;
|
||||
flex: none;
|
||||
padding-bottom: 6px;
|
||||
border-bottom: 1px solid var(--dsw-alias-border-l1);
|
||||
}
|
||||
/* Inline-editable Linear/Notion-style heading: quiet at rest, framed on hover/focus. */
|
||||
.nameInput {
|
||||
flex: 1 1 220px;
|
||||
flex: 1 1 auto;
|
||||
min-width: 0;
|
||||
min-height: 28px;
|
||||
padding: 2px 6px;
|
||||
margin-inline-start: -6px;
|
||||
border-color: transparent;
|
||||
background: transparent;
|
||||
font-size: 14px;
|
||||
line-height: 20px;
|
||||
font-weight: 600;
|
||||
}
|
||||
.nameInput:hover:not(:disabled) {
|
||||
border-color: var(--dsw-alias-border-l2);
|
||||
background: var(--dsw-alias-interactive-bg-hover);
|
||||
}
|
||||
.nameInput:focus {
|
||||
border-color: var(--dsw-alias-border-l2);
|
||||
background: var(--dsw-alias-bg-base);
|
||||
}
|
||||
.headActions {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: var(--ds-sidebar-space-2);
|
||||
flex: none;
|
||||
gap: var(--ds-sidebar-space-1);
|
||||
margin-inline-start: auto;
|
||||
}
|
||||
.action {
|
||||
composes: button from "../../ui/kit.module.css";
|
||||
}
|
||||
.primary {
|
||||
composes: buttonPrimary from "../../ui/kit.module.css";
|
||||
background: var(--dsw-alias-button-primary-fill);
|
||||
color: var(--dsw-alias-label-primary-foreground);
|
||||
}
|
||||
.primary:hover:not(:disabled) {
|
||||
background: var(--dsw-alias-button-primary-hover);
|
||||
}
|
||||
.nameInput:focus-visible,
|
||||
.select:focus-visible,
|
||||
.searchInput:focus-visible,
|
||||
.memberTitle:focus-visible {
|
||||
.scopeTrigger:focus-visible {
|
||||
outline: 2px solid var(--dsw-alias-brand-primary);
|
||||
outline-offset: 1px;
|
||||
}
|
||||
@@ -65,72 +72,40 @@
|
||||
flex-wrap: wrap;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
flex: none;
|
||||
gap: var(--ds-sidebar-space-2);
|
||||
}
|
||||
.sectionTitle {
|
||||
margin: 0;
|
||||
font-size: 12px;
|
||||
line-height: 18px;
|
||||
font-weight: 600;
|
||||
color: var(--dsw-alias-label-primary);
|
||||
font-size: 11px;
|
||||
line-height: 16px;
|
||||
font-weight: 500;
|
||||
color: var(--dsw-alias-label-tertiary);
|
||||
font-variant-numeric: tabular-nums;
|
||||
}
|
||||
.body,
|
||||
.addPage {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
flex: none;
|
||||
gap: var(--ds-sidebar-space-2);
|
||||
min-width: 0;
|
||||
min-height: 0;
|
||||
}
|
||||
.memberList {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 0;
|
||||
margin: 0;
|
||||
margin: 0 calc(-1 * var(--ds-sidebar-space-2));
|
||||
padding: 0;
|
||||
border: 0;
|
||||
list-style: none;
|
||||
}
|
||||
.memberRow,
|
||||
.addRow {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: var(--ds-sidebar-space-2);
|
||||
min-width: 0;
|
||||
box-sizing: border-box;
|
||||
padding: var(--ds-sidebar-space-1) var(--ds-sidebar-space-2);
|
||||
border-radius: var(--ds-sidebar-radius);
|
||||
}
|
||||
.memberRow:hover,
|
||||
.addRow:hover {
|
||||
background: var(--dsw-alias-interactive-bg-hover);
|
||||
}
|
||||
.memberRow[data-unresolved='true'] {
|
||||
border: 1px solid var(--dsw-alias-border-l2);
|
||||
}
|
||||
.memberGlyph {
|
||||
display: inline-flex;
|
||||
flex: none;
|
||||
color: var(--dsw-alias-label-secondary);
|
||||
}
|
||||
.memberTitle,
|
||||
.addTitle {
|
||||
flex: 1 1 auto;
|
||||
min-width: 0;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
font: inherit;
|
||||
font-size: 13px;
|
||||
line-height: 20px;
|
||||
}
|
||||
.memberTitle {
|
||||
padding: 0;
|
||||
border: 0;
|
||||
background: transparent;
|
||||
color: var(--dsw-alias-label-primary);
|
||||
text-align: start;
|
||||
cursor: pointer;
|
||||
}
|
||||
.memberSource,
|
||||
.memberState {
|
||||
flex: none;
|
||||
@@ -139,15 +114,14 @@
|
||||
line-height: 16px;
|
||||
}
|
||||
.memberState {
|
||||
padding: 0 6px;
|
||||
padding: 0 5px;
|
||||
border: 1px solid var(--dsw-alias-border-l2);
|
||||
border-radius: var(--ds-sidebar-radius);
|
||||
}
|
||||
.binding {
|
||||
display: block;
|
||||
padding: 8px 0;
|
||||
border: 0;
|
||||
background: transparent;
|
||||
flex: none;
|
||||
padding-top: 6px;
|
||||
border-top: 1px solid var(--dsw-alias-border-l1);
|
||||
}
|
||||
.bindingRow {
|
||||
display: flex;
|
||||
@@ -157,50 +131,71 @@
|
||||
}
|
||||
.bindingState {
|
||||
color: var(--dsw-alias-label-secondary);
|
||||
font-size: 12px;
|
||||
}
|
||||
.select {
|
||||
min-width: 0;
|
||||
max-width: 100%;
|
||||
box-sizing: border-box;
|
||||
min-height: var(--ds-sidebar-control-height);
|
||||
padding: 4px 8px;
|
||||
border: 1px solid var(--dsw-alias-border-l2);
|
||||
max-width: 220px;
|
||||
min-height: var(--ds-sidebar-control-sm);
|
||||
padding: 2px 8px;
|
||||
font-size: 12px;
|
||||
}
|
||||
.addToolbar {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
flex-wrap: nowrap;
|
||||
gap: 4px;
|
||||
min-width: 0;
|
||||
}
|
||||
.toolbarSpacer { flex: 1 1 0; min-width: 0; }
|
||||
.scopeTrigger {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
gap: 3px;
|
||||
flex: 0 1 auto;
|
||||
min-width: 0;
|
||||
max-width: 48%;
|
||||
min-height: 26px;
|
||||
padding: 2px 6px;
|
||||
border: 0;
|
||||
border-radius: var(--ds-sidebar-radius);
|
||||
background: var(--dsw-alias-bg-base);
|
||||
background: transparent;
|
||||
color: var(--dsw-alias-label-tertiary);
|
||||
font: var(--dsw-font-xxs-12);
|
||||
cursor: pointer;
|
||||
}
|
||||
.scopeTrigger:hover {
|
||||
background: var(--dsw-alias-interactive-bg-hover);
|
||||
color: var(--dsw-alias-label-primary);
|
||||
}
|
||||
.scopeBar {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
gap: var(--ds-sidebar-space-2);
|
||||
.scopeTrigger > span {
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
}
|
||||
.scopeTrigger > svg { flex: none; }
|
||||
.scopeHint {
|
||||
color: var(--dsw-alias-label-tertiary);
|
||||
font-size: 11px;
|
||||
line-height: 16px;
|
||||
overflow-wrap: anywhere;
|
||||
}
|
||||
.scopeBar .action {
|
||||
flex: none;
|
||||
}
|
||||
.scopeEditor {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
align-items: flex-end;
|
||||
flex-direction: column;
|
||||
gap: var(--ds-sidebar-space-2);
|
||||
padding: var(--ds-sidebar-space-3);
|
||||
padding: var(--ds-sidebar-space-2) var(--ds-sidebar-space-3);
|
||||
border: 1px solid var(--dsw-alias-border-l1);
|
||||
border-radius: var(--ds-sidebar-radius);
|
||||
background: var(--dsw-alias-bg-layer-1);
|
||||
}
|
||||
.scopeActions {
|
||||
display: flex;
|
||||
justify-content: flex-end;
|
||||
align-items: center;
|
||||
gap: var(--ds-sidebar-space-2);
|
||||
}
|
||||
.fieldError {
|
||||
flex-basis: 100%;
|
||||
color: var(--dsw-alias-state-error-primary);
|
||||
font-size: 11px;
|
||||
line-height: 16px;
|
||||
@@ -208,15 +203,7 @@
|
||||
.queryRow {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: var(--ds-sidebar-space-2);
|
||||
}
|
||||
.searchBox {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
flex: 1;
|
||||
gap: var(--ds-sidebar-space-2);
|
||||
min-width: 0;
|
||||
color: var(--dsw-alias-label-tertiary);
|
||||
}
|
||||
.searchInput {
|
||||
flex: 1;
|
||||
@@ -228,46 +215,47 @@
|
||||
min-height: 0;
|
||||
}
|
||||
.addList {
|
||||
margin: 0;
|
||||
margin: 0 calc(-1 * var(--ds-sidebar-space-2));
|
||||
padding: 0;
|
||||
list-style: none;
|
||||
}
|
||||
.addRow {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
min-width: 0;
|
||||
min-height: 30px;
|
||||
box-sizing: border-box;
|
||||
padding: 2px var(--ds-sidebar-space-2);
|
||||
border-radius: var(--ds-sidebar-radius);
|
||||
}
|
||||
.addRow:hover {
|
||||
background: var(--dsw-alias-interactive-bg-hover);
|
||||
}
|
||||
.addRow[data-selected='true'] {
|
||||
background: var(--dsw-alias-interactive-bg-active);
|
||||
}
|
||||
.addLabel {
|
||||
display: flex;
|
||||
flex: 1;
|
||||
align-items: center;
|
||||
gap: var(--ds-sidebar-space-2);
|
||||
min-width: 0;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
|
||||
.memberRow,
|
||||
.addRow { min-height: 36px; }
|
||||
.memberRow:focus-within { background: var(--dsw-alias-interactive-bg-hover); }
|
||||
@container (max-width: 390px) {
|
||||
.memberRow { flex-wrap: wrap; }
|
||||
.memberSource { max-width: 100%; overflow-wrap: anywhere; }
|
||||
.headActions { flex-wrap: wrap; margin-inline-start: 0; }
|
||||
.addTitle {
|
||||
flex: 1 1 auto;
|
||||
min-width: 0;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
font-size: 13px;
|
||||
line-height: 18px;
|
||||
}
|
||||
@media (pointer: coarse) {
|
||||
.action,
|
||||
.primary,
|
||||
.searchBox,
|
||||
.nameInput,
|
||||
.select,
|
||||
.addLabel { min-height: 44px; }
|
||||
.memberRow, .addRow { padding-block: 0; min-height: 44px; }
|
||||
.scopeTrigger,
|
||||
.addLabel,
|
||||
.addRow { min-height: 44px; }
|
||||
}
|
||||
.body,
|
||||
.addPage { flex: none; min-height: 0; }
|
||||
|
||||
.head,
|
||||
.sectionHead { flex: none; }
|
||||
.addLabel { flex: 1; }
|
||||
.body > .memberList { flex: none; }
|
||||
.binding { flex: none; }
|
||||
.binding > summary { cursor: pointer; }
|
||||
.binding > :not(summary) { margin-top: 8px; }
|
||||
.binding > summary:focus-visible { outline: 2px solid var(--dsw-alias-state-business-primary); outline-offset: 2px; }
|
||||
|
||||
.menuAnchor { position: absolute; }
|
||||
+149
-115
@@ -26,10 +26,11 @@
|
||||
import { useCallback, useEffect, useRef, useState } from 'react'
|
||||
import type { KeyboardEvent as ReactKeyboardEvent, MouseEvent as ReactMouseEvent, ReactNode } from 'react'
|
||||
import {
|
||||
IconChevronRightOutlineRegular,
|
||||
IconCloseOutlineRegular,
|
||||
IconContextInjectionOutlineRegular,
|
||||
IconInspectOutlineRegular,
|
||||
IconPlusOutlineRegular,
|
||||
IconSearchOutlineRegular,
|
||||
IconShareOutlineRegular,
|
||||
IconTrashOutlineRegular,
|
||||
} from '@deepseek-ai/dsh-client-ui-primitives'
|
||||
@@ -75,9 +76,10 @@ import { SourceReadiness } from '../sources/readiness.tsx'
|
||||
import { SelectMenu } from '../../ui/SelectMenu.tsx'
|
||||
import { LoadingIndicator } from '../../ui/LoadingIndicator.tsx'
|
||||
import {
|
||||
ActionButton, ActionFooter, Checkbox, EmptyState, ErrorBlock, IconButton, Menu, Notice, TextInput,
|
||||
ActionButton, ActionFooter, Checkbox, Disclosure, EmptyState, ErrorBlock, IconButton, ListRow, Menu, Notice, SearchField, TextInput,
|
||||
} from '../../ui/index.ts'
|
||||
import { useScrollLoad } from '../../ui/use-scroll-load.ts'
|
||||
import { preferredClueWindowSurface, type ClueWindowSurface } from '../../prefs.ts'
|
||||
import { t } from '../../locales.ts'
|
||||
import type { ClueDetailTarget } from './detail.tsx'
|
||||
import css from './pack.module.css'
|
||||
@@ -111,6 +113,7 @@ interface PackManagementOptions {
|
||||
readonly scopes?: Readonly<Record<string, JsonValue | undefined>>
|
||||
/** Persist one explicitly chosen range (same shape as the tab browser). */
|
||||
onScopeChange?(sourceId: string, scope: JsonValue | undefined): void
|
||||
readonly surface?: ClueWindowSurface
|
||||
}
|
||||
|
||||
/** One member row as the panel renders it. */
|
||||
@@ -201,7 +204,7 @@ export function openPackManagementWindow(options: PackManagementOptions): Window
|
||||
dirty ? `${options.pack.name} · ${t('cluePackUnsaved')}` : options.pack.name
|
||||
const handle: WindowHandle = options.windows.open({
|
||||
id: packWindowId(options.pack.id),
|
||||
surface: 'sidebar',
|
||||
surface: options.surface ?? preferredClueWindowSurface(),
|
||||
title: titleFor(false),
|
||||
size: 'collection',
|
||||
content: <PackManagementPage {...options} guard={guard} />,
|
||||
@@ -958,6 +961,11 @@ export function PackManagementPage(
|
||||
disabled={saving || loading}
|
||||
onChange={(event) => { setName(event.target.value); setNameSaved(false) }}
|
||||
onKeyDown={(event) => {
|
||||
if (event.key === 'Escape' && pendingName) {
|
||||
event.preventDefault()
|
||||
discardDraft()
|
||||
return
|
||||
}
|
||||
if (event.key !== 'Enter' || event.nativeEvent.isComposing || event.keyCode === 229) return
|
||||
if (!pendingName) return
|
||||
event.preventDefault()
|
||||
@@ -966,6 +974,7 @@ export function PackManagementPage(
|
||||
/>
|
||||
<div className={css.headActions}>
|
||||
<IconButton
|
||||
size="sm"
|
||||
icon={<IconShareOutlineRegular size={14} />}
|
||||
label={t('clueShareExport')}
|
||||
onClick={() => {
|
||||
@@ -995,9 +1004,8 @@ export function PackManagementPage(
|
||||
|
||||
<div className={css.sectionHead}>
|
||||
<h3 className={css.sectionTitle}>{t('cluePackMembers', { n: members.length })}</h3>
|
||||
<button
|
||||
type="button"
|
||||
className={css.action}
|
||||
<ActionButton
|
||||
size="sm"
|
||||
aria-pressed={addOpen}
|
||||
onClick={() => {
|
||||
if (addOpen) {
|
||||
@@ -1007,44 +1015,60 @@ export function PackManagementPage(
|
||||
setAddOpen(value => !value)
|
||||
}}
|
||||
>
|
||||
{!addOpen && <IconPlusOutlineRegular size={14} />}
|
||||
{addOpen ? t('cluePackBack') : t('cluePackAddMembers')}
|
||||
</button>
|
||||
</ActionButton>
|
||||
</div>
|
||||
|
||||
{addOpen ? (
|
||||
<div className={css.addPage} data-clue-add-member>
|
||||
<SourceNavigation
|
||||
sources={enabledSources}
|
||||
displays={displays}
|
||||
activeId={addSourceId ?? ''}
|
||||
onChange={pickSource}
|
||||
/>
|
||||
<div className={css.addToolbar}>
|
||||
<SourceNavigation
|
||||
sources={enabledSources}
|
||||
displays={displays}
|
||||
activeId={addSourceId ?? ''}
|
||||
onChange={pickSource}
|
||||
/>
|
||||
{addSourceId !== null && addSourceId !== BUILTIN_SOURCE_IDS.feishuTasks && (
|
||||
<button
|
||||
type="button"
|
||||
className={css.scopeTrigger}
|
||||
aria-expanded={addScopeOpen}
|
||||
aria-label={t('clueBrowserScopeEdit')}
|
||||
title={`${t('clueBrowserScopeHeading')}: ${addSummary ?? t('clueBrowserScopeNeeded')}`}
|
||||
onClick={() => { setAddScopeOpen(value => !value) }}
|
||||
>
|
||||
<span>{addSummary ?? t('clueBrowserScopeEdit')}</span>
|
||||
<IconChevronRightOutlineRegular size={12} />
|
||||
</button>
|
||||
)}
|
||||
<span className={css.toolbarSpacer} />
|
||||
{addSourceId !== null && enabledSources.find(source => source.sourceId === addSourceId) !== undefined && (
|
||||
<ResourceFilters
|
||||
source={enabledSources.find(source => source.sourceId === addSourceId)!}
|
||||
scope={addScope}
|
||||
mode={addView.kind === 'search' ? 'search' : 'list'}
|
||||
onChange={next => {
|
||||
if (addSourceId === null) return
|
||||
cancelAddSearch()
|
||||
const nextScopes = { ...addScopes, [addSourceId]: next }
|
||||
setAddScopes(nextScopes)
|
||||
props.onScopeChange?.(addSourceId, next)
|
||||
resetAdd()
|
||||
void loadAdd(addSourceId, addView, undefined, nextScopes)
|
||||
}}
|
||||
/>
|
||||
)}
|
||||
</div>
|
||||
{enabledSources.length === 0 && <EmptyState title={t('clueBrowserAllDisabled')} />}
|
||||
|
||||
|
||||
{addSourceId === null ? (
|
||||
<EmptyState title={t('cluePackPickSource')} />
|
||||
) : (
|
||||
<>
|
||||
<div className={css.scopeBar}>
|
||||
{addSourceId === BUILTIN_SOURCE_IDS.feishuTasks
|
||||
? <span className={css.scopeHint}>{t('clueBrowserScopeTasksHint')}</span>
|
||||
: (
|
||||
<>
|
||||
<button
|
||||
type="button"
|
||||
className={css.action}
|
||||
aria-expanded={addScopeOpen}
|
||||
aria-label={t('clueBrowserScopeEdit')}
|
||||
title={`${t('clueBrowserScopeHeading')}: ${addSummary ?? t('clueBrowserScopeNeeded')}`}
|
||||
onClick={() => { setAddScopeOpen(value => !value) }}
|
||||
>
|
||||
{t('clueBrowserScopeEdit')}
|
||||
</button>
|
||||
<span className={css.scopeHint}>{addSummary ?? t('clueBrowserScopeNeeded')}</span>
|
||||
</>
|
||||
)}
|
||||
</div>
|
||||
{addSourceId === BUILTIN_SOURCE_IDS.feishuTasks && (
|
||||
<span className={css.scopeHint}>{t('clueBrowserScopeTasksHint')}</span>
|
||||
)}
|
||||
|
||||
{addScopeOpen && addSourceId !== BUILTIN_SOURCE_IDS.feishuTasks && (
|
||||
<form
|
||||
@@ -1058,54 +1082,56 @@ export function PackManagementPage(
|
||||
/>
|
||||
{addScopeError !== null && <span className={css.fieldError} role="alert">{addScopeError}</span>}
|
||||
<div className={css.scopeActions}>
|
||||
<button type="submit" className={css.primary}>{t('clueBrowserScopeApply')}</button>
|
||||
<button
|
||||
type="button"
|
||||
className={css.action}
|
||||
onClick={() => { setAddScopeOpen(false); setAddScopeError(null) }}
|
||||
>
|
||||
<ActionButton size="sm" onClick={() => { setAddScopeOpen(false); setAddScopeError(null) }}>
|
||||
{t('cancel')}
|
||||
</button>
|
||||
</ActionButton>
|
||||
<ActionButton size="sm" type="submit" variant="primary">{t('clueBrowserScopeApply')}</ActionButton>
|
||||
</div>
|
||||
</form>
|
||||
)}
|
||||
|
||||
<div className={css.queryRow}>
|
||||
<label className={css.searchBox}>
|
||||
<IconSearchOutlineRegular size={14} />
|
||||
<TextInput
|
||||
type="text"
|
||||
className={css.searchInput}
|
||||
value={addQuery}
|
||||
placeholder={t('clueBrowserSearchPlaceholder')}
|
||||
aria-label={t('clueBrowserSearchPlaceholder')}
|
||||
onChange={(event) => { changeAddQuery(event.target.value) }}
|
||||
onCompositionStart={() => { setComposing(true); cancelAddSearch() }}
|
||||
onCompositionEnd={() => { setComposing(false) }}
|
||||
onKeyDown={(event) => {
|
||||
if (event.key !== 'Enter' || event.nativeEvent.isComposing || event.keyCode === 229) return
|
||||
<SearchField
|
||||
className={css.searchInput}
|
||||
value={addQuery}
|
||||
placeholder={t('clueBrowserSearchPlaceholder')}
|
||||
aria-label={t('clueBrowserSearchPlaceholder')}
|
||||
onChange={(event) => { changeAddQuery(event.target.value) }}
|
||||
onCompositionStart={() => { setComposing(true); cancelAddSearch() }}
|
||||
onCompositionEnd={() => { setComposing(false) }}
|
||||
onKeyDown={(event) => {
|
||||
if (event.key === 'Escape' && addQuery !== '') {
|
||||
event.preventDefault()
|
||||
submitAddQuery()
|
||||
}}
|
||||
/>
|
||||
</label>
|
||||
<button type="button" className={css.action} onClick={submitAddQuery}>
|
||||
{looksLikeResource(addQuery.trim()) ? t('clueBrowserResolveAction') : t('clueBrowserSearchAction')}
|
||||
</button>
|
||||
event.stopPropagation()
|
||||
changeAddQuery('')
|
||||
return
|
||||
}
|
||||
if (event.key !== 'Enter' || event.nativeEvent.isComposing || event.keyCode === 229) return
|
||||
event.preventDefault()
|
||||
submitAddQuery()
|
||||
}}
|
||||
trailing={addQuery !== ''
|
||||
? (
|
||||
<>
|
||||
<IconButton
|
||||
size="sm"
|
||||
label={t('clueClearSearch')}
|
||||
onClick={() => { changeAddQuery('') }}
|
||||
icon={<IconCloseOutlineRegular size={12} />}
|
||||
/>
|
||||
<IconButton
|
||||
size="sm"
|
||||
label={looksLikeResource(addQuery.trim()) ? t('clueBrowserResolveAction') : t('clueBrowserSearchAction')}
|
||||
onClick={submitAddQuery}
|
||||
icon={<IconChevronRightOutlineRegular size={14} />}
|
||||
/>
|
||||
</>
|
||||
)
|
||||
: undefined}
|
||||
/>
|
||||
</div>
|
||||
{/* Setup is actionable below the query row: a probe must never
|
||||
insert a checking row that moves the search box. */}
|
||||
{enabledSources.find(source => source.sourceId === addSourceId) !== undefined && <ResourceFilters
|
||||
source={enabledSources.find(source => source.sourceId === addSourceId)!} scope={addScope}
|
||||
mode={addView.kind === 'search' ? 'search' : 'list'} onChange={next => {
|
||||
if (addSourceId === null) return
|
||||
cancelAddSearch()
|
||||
const nextScopes = { ...addScopes, [addSourceId]: next }
|
||||
setAddScopes(nextScopes)
|
||||
props.onScopeChange?.(addSourceId, next)
|
||||
resetAdd()
|
||||
void loadAdd(addSourceId, addView, undefined, nextScopes)
|
||||
}} />}
|
||||
{enabledSources.find(source => source.sourceId === addSourceId) !== undefined && <SourceReadiness
|
||||
key={addSourceId} source={enabledSources.find(source => source.sourceId === addSourceId)!}
|
||||
display={displays.find(display => display.sourceId === addSourceId)}
|
||||
@@ -1135,6 +1161,7 @@ export function PackManagementPage(
|
||||
<li
|
||||
key={key}
|
||||
className={css.addRow}
|
||||
data-selected={addSelected.has(key) ? 'true' : undefined}
|
||||
onContextMenu={(event) => {
|
||||
setRowMenu({ kind: 'candidate', candidate, ...contextMenuPoint(event) })
|
||||
}}
|
||||
@@ -1150,7 +1177,7 @@ export function PackManagementPage(
|
||||
onChange={() => { toggleAddSelection(candidate) }}
|
||||
/>
|
||||
<span className={css.memberGlyph} aria-hidden="true">{resourceIcon(candidate, displays)}</span>
|
||||
<span className={css.addTitle}>{candidate.title}</span>
|
||||
<span className={css.addTitle} title={candidate.title}>{candidate.title}</span>
|
||||
<span className={css.memberSource}><ResourceInlineMeta info={candidate.info} />{candidate.info?.state === undefined ? candidate.subtitle : null}</span>
|
||||
</label>
|
||||
</li>
|
||||
@@ -1185,7 +1212,6 @@ export function PackManagementPage(
|
||||
{members.map(row => (
|
||||
<li
|
||||
key={row.clue.id}
|
||||
className={css.memberRow}
|
||||
data-clue-pack-member={row.clue.id}
|
||||
data-unresolved={row.readable ? undefined : 'true'}
|
||||
onContextMenu={(event) => {
|
||||
@@ -1196,35 +1222,45 @@ export function PackManagementPage(
|
||||
if (point !== undefined) setRowMenu({ kind: 'member', row, ...point })
|
||||
}}
|
||||
>
|
||||
<span className={css.memberGlyph} aria-hidden="true">{resourceIcon(row.clue, displays)}</span>
|
||||
<button
|
||||
type="button"
|
||||
className={css.memberTitle}
|
||||
<ListRow
|
||||
title={row.clue.title}
|
||||
onClick={() => { openMemberDetail(row) }}
|
||||
>
|
||||
{row.clue.title}
|
||||
</button>
|
||||
<span className={css.memberSource}><ResourceInlineMeta info={row.clue.info} />{row.clue.info?.state === undefined ? displayName(row.clue.sourceId) : null}</span>
|
||||
{row.readable
|
||||
? null
|
||||
: <span className={css.memberState}>{t('cluePackMemberUnresolved')}</span>}
|
||||
<IconButton
|
||||
icon={<IconContextInjectionOutlineRegular size={16} />}
|
||||
label={t('clueBrowserInsertRow', { title: row.clue.title })}
|
||||
title={t('clueBrowserInsert')} onClick={() => { props.onInsertClue(row.clue.id, row.clue.title) }} />
|
||||
<IconButton
|
||||
icon={<IconTrashOutlineRegular size={14} />}
|
||||
label={t('cluePackRemoveMember', { title: row.clue.title })}
|
||||
disabled={saving}
|
||||
onClick={() => { void removeMember(row.clue.id) }} />
|
||||
titleLabel={row.clue.title}
|
||||
titleAs="button"
|
||||
dimmed={!row.readable}
|
||||
onTitleClick={() => { openMemberDetail(row) }}
|
||||
leading={<span className={css.memberGlyph} aria-hidden="true">{resourceIcon(row.clue, displays)}</span>}
|
||||
subtitle={row.clue.info === undefined ? undefined : <ResourceInlineMeta info={row.clue.info} />}
|
||||
meta={<>
|
||||
{row.clue.info?.state === undefined && <span className={css.memberSource}>{displayName(row.clue.sourceId)}</span>}
|
||||
{!row.readable && <span className={css.memberState}>{t('cluePackMemberUnresolved')}</span>}
|
||||
</>}
|
||||
actions={<>
|
||||
<IconButton
|
||||
size="sm"
|
||||
icon={<IconContextInjectionOutlineRegular size={14} />}
|
||||
label={t('clueBrowserInsertRow', { title: row.clue.title })}
|
||||
title={t('clueBrowserInsert')}
|
||||
onClick={() => { props.onInsertClue(row.clue.id, row.clue.title) }}
|
||||
/>
|
||||
<IconButton
|
||||
size="sm"
|
||||
icon={<IconTrashOutlineRegular size={14} />}
|
||||
label={t('cluePackRemoveMember', { title: row.clue.title })}
|
||||
disabled={saving}
|
||||
onClick={() => { void removeMember(row.clue.id) }}
|
||||
/>
|
||||
</>}
|
||||
/>
|
||||
</li>
|
||||
))}
|
||||
</ul>
|
||||
)}
|
||||
|
||||
<details className={css.binding} data-clue-binding-panel>
|
||||
<summary className={css.sectionTitle}>{t('cluePackBindingHeading')}</summary>
|
||||
<Disclosure
|
||||
className={css.binding}
|
||||
data-clue-binding-panel
|
||||
summary={t('cluePackBindingHeading')}
|
||||
>
|
||||
{bindingsError
|
||||
? (
|
||||
<ErrorBlock message={t('clueStateRequestFailed')} retryLabel={t('retry')}
|
||||
@@ -1234,14 +1270,13 @@ export function PackManagementPage(
|
||||
? (
|
||||
<div className={css.bindingRow}>
|
||||
<span className={css.bindingState}>{t('cluePackBound')}</span>
|
||||
<button
|
||||
type="button"
|
||||
className={css.action}
|
||||
<ActionButton
|
||||
size="sm"
|
||||
disabled={bindingBusy}
|
||||
onClick={() => { void removeBinding() }}
|
||||
>
|
||||
{t('cluePackUnbind')}
|
||||
</button>
|
||||
</ActionButton>
|
||||
</div>
|
||||
)
|
||||
: (
|
||||
@@ -1254,42 +1289,41 @@ export function PackManagementPage(
|
||||
onChange={setBindingTarget}
|
||||
options={workspaces.map(workspace => ({ value: workspace.workspaceId, label: workspace.title }))}
|
||||
/>
|
||||
<button
|
||||
type="button"
|
||||
className={css.action}
|
||||
<ActionButton
|
||||
size="sm"
|
||||
disabled={bindingBusy || workspaces.length === 0}
|
||||
onClick={() => { void addBinding() }}
|
||||
>
|
||||
{t('cluePackBind')}
|
||||
</button>
|
||||
</ActionButton>
|
||||
</div>
|
||||
)}
|
||||
</details>
|
||||
</Disclosure>
|
||||
|
||||
</div>
|
||||
)}
|
||||
|
||||
</div>
|
||||
|
||||
{addOpen && addSelected.size > 0 && (
|
||||
<ActionFooter bleed data-clue-pack-add-footer
|
||||
start={t('clueBrowserSelected', { n: addSelected.size })}
|
||||
end={<ActionButton variant="primary" busy={saving} onClick={() => { void addMembers() }}>
|
||||
{t('cluePackAddSelected')}
|
||||
</ActionButton>} />
|
||||
)}
|
||||
{addOpen && addSelected.size > 0 && (
|
||||
<ActionFooter bleed data-clue-pack-add-footer
|
||||
start={t('clueBrowserSelected', { n: addSelected.size })}
|
||||
end={<ActionButton size="sm" variant="primary" busy={saving} onClick={() => { void addMembers() }}>
|
||||
{t('cluePackAddSelected')}
|
||||
</ActionButton>} />
|
||||
)}
|
||||
|
||||
{!addOpen && (
|
||||
<ActionFooter bleed data-clue-pack-footer
|
||||
start={<span data-clue-pack-save-status>{pendingName ? t('unsaved') : nameSaved ? t('saved') : null}</span>}
|
||||
end={pendingName ? (
|
||||
<>
|
||||
<ActionButton disabled={saving} onClick={discardDraft}>{t('cancel')}</ActionButton>
|
||||
<ActionButton variant="primary" busy={saving} disabled={name.trim() === ''}
|
||||
<ActionButton size="sm" disabled={saving} onClick={discardDraft}>{t('cancel')}</ActionButton>
|
||||
<ActionButton size="sm" variant="primary" busy={saving} disabled={name.trim() === ''}
|
||||
onClick={() => { void saveName() }}>{t('save')}</ActionButton>
|
||||
</>
|
||||
) : (
|
||||
<ActionButton variant="primary" disabled={saving || loading || error !== null}
|
||||
<ActionButton size="sm" variant="primary" disabled={saving || loading || error !== null}
|
||||
onClick={() => { props.onInsertPack(pack) }}>{t('cluePackInsert')}</ActionButton>
|
||||
)} />
|
||||
)}
|
||||
|
||||
@@ -27,8 +27,7 @@
|
||||
display: flex;
|
||||
gap: var(--ds-sidebar-space-1);
|
||||
flex: none;
|
||||
border-bottom: 1px solid var(--dsw-alias-border-l1);
|
||||
padding-bottom: 8px;
|
||||
padding: 0 0 6px;
|
||||
}
|
||||
|
||||
.body {
|
||||
@@ -135,11 +134,53 @@
|
||||
overflow-wrap: anywhere;
|
||||
}
|
||||
|
||||
.fileRow {
|
||||
.filePicker {
|
||||
position: relative;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: var(--ds-sidebar-space-1);
|
||||
align-items: center;
|
||||
gap: var(--ds-sidebar-space-2);
|
||||
min-width: 0;
|
||||
min-height: 36px;
|
||||
padding: 4px 10px;
|
||||
box-sizing: border-box;
|
||||
border: 1px solid var(--dsw-alias-border-l2);
|
||||
border-radius: var(--ds-sidebar-radius);
|
||||
background: var(--dsw-alias-bg-base);
|
||||
cursor: pointer;
|
||||
}
|
||||
.filePicker:hover {
|
||||
background: var(--dsw-alias-interactive-bg-hover);
|
||||
}
|
||||
.filePicker:has(.fileInput:focus-visible) {
|
||||
outline: 2px solid var(--dsw-alias-brand-primary);
|
||||
outline-offset: 1px;
|
||||
}
|
||||
.fileInput {
|
||||
position: absolute;
|
||||
inset: 0;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
margin: 0;
|
||||
opacity: 0;
|
||||
cursor: inherit;
|
||||
}
|
||||
.fileButton {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
flex: none;
|
||||
gap: 5px;
|
||||
color: var(--dsw-alias-label-primary);
|
||||
font-weight: 500;
|
||||
white-space: nowrap;
|
||||
}
|
||||
.fileName {
|
||||
flex: 1 1 auto;
|
||||
min-width: 0;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
color: var(--dsw-alias-label-tertiary);
|
||||
font-size: 12px;
|
||||
}
|
||||
|
||||
.content {
|
||||
@@ -153,7 +194,6 @@
|
||||
.hint { font: var(--dsw-font-xxs-12); }
|
||||
.itemRow + .itemRow { border-top: 1px solid var(--dsw-alias-border-l1); }
|
||||
.summaryRow { font-variant-numeric: tabular-nums; }
|
||||
.fileRow input { max-width: 100%; min-width: 0; color: var(--dsw-alias-label-secondary); font: inherit; }
|
||||
@media (pointer: coarse) {
|
||||
.action { min-height: 44px; }
|
||||
.action, .filePicker { min-height: 44px; }
|
||||
}
|
||||
@@ -16,7 +16,7 @@
|
||||
*/
|
||||
import { useCallback, useEffect, useMemo, useRef, useState } from 'react'
|
||||
import type { ReactNode } from 'react'
|
||||
import { IconCloseOutlineRegular, IconDownloadOutlineRegular, IconRefreshOutlineRegular } from '@deepseek-ai/dsh-client-ui-primitives'
|
||||
import { IconCloseOutlineRegular, IconDownloadOutlineRegular, IconFolderOpenOutlineRegular, IconRefreshOutlineRegular } from '@deepseek-ai/dsh-client-ui-primitives'
|
||||
import type { BetterSidebarCluesClientFace } from '../registry.ts'
|
||||
import type { BetterSidebarWindowsClientFace, WindowHandle } from '../../windows/types.ts'
|
||||
import type { CluePack, CluesPacksResult } from '../../../clues/types.ts'
|
||||
@@ -36,6 +36,7 @@ import {
|
||||
type ShareProgress,
|
||||
} from '../share-client.ts'
|
||||
import { cluesApi, peekClueRequest } from '../api.ts'
|
||||
import { preferredClueWindowSurface, type ClueWindowSurface } from '../../prefs.ts'
|
||||
import { t } from '../../locales.ts'
|
||||
import {
|
||||
ActionButton, ActionFooter, ChoiceCard, EmptyState, ErrorBlock, Field, Notice, Tabs,
|
||||
@@ -55,6 +56,7 @@ interface OpenShareWindowOptions {
|
||||
readonly packIds?: readonly string[]
|
||||
/** Initial direction (the tab's Import entry opens the import page). */
|
||||
readonly direction?: 'export' | 'import'
|
||||
readonly surface?: ClueWindowSurface
|
||||
}
|
||||
|
||||
/** One request delivered to an ALREADY-OPEN share window. */
|
||||
@@ -84,7 +86,7 @@ function requestShareWindow(request: ShareWindowRequest): void {
|
||||
export function openShareWindow(options: OpenShareWindowOptions): WindowHandle {
|
||||
const handle = options.windows.open({
|
||||
id: CLUE_SHARE_WINDOW_ID,
|
||||
surface: 'sidebar',
|
||||
surface: options.surface ?? preferredClueWindowSurface(),
|
||||
title: t('clueShareTitle'),
|
||||
size: 'collection',
|
||||
bodyLayout: 'fill',
|
||||
@@ -536,19 +538,25 @@ export function SharePage(props: OpenShareWindowOptions): ReactNode {
|
||||
) : (
|
||||
<div className={css.body}>
|
||||
<p className={css.hint}>{t('clueShareImportHint')}</p>
|
||||
<label className={css.fileRow}>
|
||||
<span className={css.fieldLabel}>{t('clueShareChooseFile')}</span>
|
||||
<input
|
||||
type="file"
|
||||
accept=".cluepack,application/zip"
|
||||
disabled={busy}
|
||||
onChange={(event) => {
|
||||
const file = event.target.files?.[0]
|
||||
if (file !== undefined) void chooseFile(file)
|
||||
}}
|
||||
/>
|
||||
<span className={css.hint}>{fileName ?? t('clueShareNoFile')}</span>
|
||||
</label>
|
||||
<Field label={t('clueShareChooseFile')}>
|
||||
<label className={css.filePicker}>
|
||||
<input
|
||||
className={css.fileInput}
|
||||
type="file"
|
||||
accept=".cluepack,application/zip"
|
||||
disabled={busy}
|
||||
onChange={(event) => {
|
||||
const file = event.target.files?.[0]
|
||||
if (file !== undefined) void chooseFile(file)
|
||||
}}
|
||||
/>
|
||||
<span className={css.fileButton}>
|
||||
<IconFolderOpenOutlineRegular size={14} />
|
||||
{t('clueShareChooseFile')}
|
||||
</span>
|
||||
<span className={css.fileName} title={fileName ?? undefined}>{fileName ?? t('clueShareNoFile')}</span>
|
||||
</label>
|
||||
</Field>
|
||||
|
||||
{importPreview !== null && importResult === null && (
|
||||
<section className={css.summary} aria-label={t('clueSharePreview')}>
|
||||
@@ -620,30 +628,30 @@ export function SharePage(props: OpenShareWindowOptions): ReactNode {
|
||||
start={direction === 'export' ? t('clueSharePackCount', { n: selectedPacks.size }) : fileName ?? t('clueShareNoFile')}
|
||||
end={<>
|
||||
{busy ? (
|
||||
<button type="button" className={css.action} onClick={cancel}>
|
||||
<ActionButton size="sm" onClick={cancel}>
|
||||
<IconCloseOutlineRegular size={14} />
|
||||
{t('cancel')}
|
||||
</button>
|
||||
</ActionButton>
|
||||
) : (
|
||||
<button type="button" className={css.action} onClick={reset}>
|
||||
<ActionButton size="sm" onClick={reset}>
|
||||
<IconRefreshOutlineRegular size={14} />
|
||||
{t('clueShareReset')}
|
||||
</button>
|
||||
</ActionButton>
|
||||
)}
|
||||
{direction === 'export' ? (
|
||||
<ActionButton variant="primary" busy={busy} disabled={packsLoading || packsError || selectedPacks.size === 0}
|
||||
<ActionButton size="sm" variant="primary" busy={busy} disabled={packsLoading || packsError || selectedPacks.size === 0}
|
||||
onClick={() => { if (preview === null) void runPreview(); else void runExport() }}>
|
||||
{preview === null ? t('clueSharePreview') : <><IconDownloadOutlineRegular size={14} />{t('clueShareExportAction')}</>}
|
||||
</ActionButton>
|
||||
) : importResult?.requiresAcceptance === true ? (
|
||||
<ActionButton variant="primary" onClick={() => {
|
||||
<ActionButton size="sm" variant="primary" onClick={() => {
|
||||
setImportResult({ ...importResult, requiresAcceptance: false })
|
||||
setMessage(t('clueShareAcceptPartial'))
|
||||
}}>
|
||||
{t('clueShareAcceptPartial')}
|
||||
</ActionButton>
|
||||
) : (
|
||||
<ActionButton variant="primary" busy={busy} disabled={importBytes === null || importPreview === null || importResult !== null} onClick={() => { void runImport() }}>
|
||||
<ActionButton size="sm" variant="primary" busy={busy} disabled={importBytes === null || importPreview === null || importResult !== null} onClick={() => { void runImport() }}>
|
||||
{t('clueShareImportAction')}
|
||||
</ActionButton>
|
||||
)}
|
||||
|
||||
Reference in new issue
Block a user