mirror of
https://github.com/storytold/autocraft.git
synced 2026-11-24 16:31:06 +01:00
Needs you: an answered decision stays on screen, on the phone and the desktop
This commit is contained in:
1 parent
c5fcc9f0f8
commit
02469b5d16
2 files changed
+8
-20
No files matched your search
@@ -17,9 +17,8 @@ import { TimeAgo } from "../../ui/atoms/TimeAgo";
|
||||
import { ClaimPill, ClassifierLines, Disclosure, Facts, KindTag, RelatedList } from "./parts";
|
||||
import { Refs } from "./Refs";
|
||||
import { ExecLine } from "./ExecLine";
|
||||
import { AnswerNotice } from "./AnswerNotice";
|
||||
import { DuplicateGroup, RiskList } from "./Group";
|
||||
import { localActions, ordered, refOf, useDecisionFilter, useDecisionList, useLocal, usePinned, useSelection, useUndo, type AnswerEntry } from "./state";
|
||||
import { localActions, ordered, refOf, useDecisionFilter, useDecisionList, useLocal, usePinned, useSelection, useUndo } from "./state";
|
||||
import { WorkflowBox } from "./Workflow";
|
||||
import { ItemThread } from "../item/ItemThread";
|
||||
import { scrollToThreadEnd } from "../item/ItemDecisions";
|
||||
@@ -37,29 +36,26 @@ export function DetailPanel({ user }: ViewProps) {
|
||||
const checked = list.filter((d) => loc.checked.has(d.id));
|
||||
|
||||
if (checked.length > 1) return <MultiAnswer ds={checked} user={user} />;
|
||||
const just = loc.justAnswered.find((x) => x.id === id);
|
||||
const inList = list.find((x) => x.id === id);
|
||||
const pinned = usePinned(id, !!inList || !!just);
|
||||
const pinned = usePinned(id, !!inList);
|
||||
const d = inList ?? pinned ?? null;
|
||||
const idx = d ? list.indexOf(d) : -1;
|
||||
|
||||
return (
|
||||
<div className="flex h-full min-h-0 flex-col">
|
||||
<div className="flex h-10 shrink-0 items-center gap-2 border-b border-line px-4 pr-10 text-xs text-ink/55">
|
||||
{data && d && (
|
||||
{data && idx >= 0 && (
|
||||
<span className="num">
|
||||
{idx + 1} of {list.length}
|
||||
</span>
|
||||
)}
|
||||
<div className="ml-auto flex items-center">
|
||||
<IconButton size="sm" icon={CaretLeftIcon} label="Previous (k)" disabled={idx <= 0} onClick={() => go(list[idx - 1])} />
|
||||
<IconButton size="sm" icon={CaretRightIcon} label="Next (j)" disabled={idx < 0 || idx >= list.length - 1} onClick={() => go(list[idx + 1])} />
|
||||
<IconButton size="sm" icon={CaretRightIcon} label="Next (j)" disabled={idx >= list.length - 1} onClick={() => go(list[idx + 1])} />
|
||||
</div>
|
||||
</div>
|
||||
{just && !d ? (
|
||||
<AnsweredNotice entry={just} />
|
||||
) : d ? (
|
||||
<DecisionBody key={d.id} d={d} user={user} onAnswered={() => go(list[idx + 1] ?? list[idx - 1], true)} />
|
||||
{d ? (
|
||||
<DecisionBody key={d.id} d={d} user={user} />
|
||||
) : missing && item ? (
|
||||
<NoDecision repo={item.repo} number={item.number} />
|
||||
) : (
|
||||
@@ -103,14 +99,6 @@ function EmptyDetail({ count }: { count: number }) {
|
||||
);
|
||||
}
|
||||
|
||||
function AnsweredNotice({ entry }: { entry: AnswerEntry }) {
|
||||
return (
|
||||
<div className="flex h-full items-center justify-center p-8">
|
||||
<AnswerNotice entry={entry} className="max-w-md rounded-md border border-line px-4" />
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
function Section({ title, children }: { title: ReactNode; children: ReactNode }) {
|
||||
return (
|
||||
<section className="mt-5">
|
||||
|
||||
@@ -9,7 +9,7 @@ import { InboxList, summaryLine } from "./InboxList";
|
||||
import { DecisionsToolbar } from "./Toolbar";
|
||||
import { ordered, useDecisionFilter, useDecisionList, useLocal, usePinned, useReselectOnFilter, useSelection } from "./state";
|
||||
|
||||
/** Phone flow: one decision per screen with previous/next, filters in a sheet. */
|
||||
/** Phone flow: one decision per screen with previous/next, filters in a sheet. An answered decision stays on screen. */
|
||||
export function PhoneInbox(props: ViewProps) {
|
||||
const { data, loading } = useDecisionList();
|
||||
const { filter } = useDecisionFilter();
|
||||
@@ -56,7 +56,7 @@ export function PhoneInbox(props: ViewProps) {
|
||||
</div>
|
||||
)}
|
||||
{detail && <div className="flex min-h-0 flex-1 flex-col">
|
||||
{d ? <DecisionBody key={d.id} d={d} user={props.user} phone onAnswered={() => go(list[idx + 1] ?? list[idx - 1], true)} pager={{ pos: `${idx + 1} of ${list.length}`, prev: idx > 0 ? () => go(list[idx - 1]) : undefined, next: idx < list.length - 1 ? () => go(list[idx + 1]) : undefined }} /> : missing && item ? <NoDecision repo={item.repo} number={item.number} /> : <p className="py-16 text-center text-sm text-ink/60">Nothing waiting.</p>}
|
||||
{d ? <DecisionBody key={d.id} d={d} user={props.user} phone pager={{ pos: idx >= 0 ? `${idx + 1} of ${list.length}` : "", prev: idx > 0 ? () => go(list[idx - 1]) : undefined, next: idx < list.length - 1 ? () => go(list[idx + 1]) : undefined }} /> : missing && item ? <NoDecision repo={item.repo} number={item.number} /> : <p className="py-16 text-center text-sm text-ink/60">Nothing waiting.</p>}
|
||||
</div>}
|
||||
<Dialog.Root open={sheet} onOpenChange={setSheet}>
|
||||
<Dialog.Portal>
|
||||
|
||||
Reference in new issue
Block a user