feat: triage streams with open, close (#121)
* refactor: use interfaces for function params * cleanup message retention code * support open / closed streams - Tabs for viewing separately - Context menu to close / open streams - Update stream particle status field * ui tweak * show stream state in stream-view * ui tweaks * cleanup message retention from orion api
This commit was merged in pull request #121.
This commit is contained in:
@@ -23,6 +23,8 @@ interface ComposeOverlayProps {
|
||||
targetPath?: ParticlePath;
|
||||
onActiveChange?: (active: boolean) => void;
|
||||
onParticleCreated?: (particleId: string) => void;
|
||||
/** When true, composing is blocked (e.g. stream is closed). */
|
||||
disabled?: boolean;
|
||||
}
|
||||
|
||||
|
||||
@@ -37,6 +39,7 @@ export function ComposeOverlay({
|
||||
targetPath,
|
||||
onActiveChange,
|
||||
onParticleCreated,
|
||||
disabled,
|
||||
}: ComposeOverlayProps) {
|
||||
const [step, setStep] = useState<ComposeStep>("idle");
|
||||
const [error, setError] = useState<string | null>(null);
|
||||
@@ -56,6 +59,8 @@ export function ComposeOverlay({
|
||||
// Refs for synchronous reads in keyboard handlers
|
||||
const stepRef = useRef(step);
|
||||
const recordStartRef = useRef(0);
|
||||
const disabledRef = useRef(disabled);
|
||||
disabledRef.current = disabled;
|
||||
|
||||
const setStepSync = useCallback((next: ComposeStep) => {
|
||||
stepRef.current = next;
|
||||
@@ -303,7 +308,6 @@ export function ComposeOverlay({
|
||||
networkId,
|
||||
properties: {
|
||||
name: streamName,
|
||||
status: "open",
|
||||
},
|
||||
createdByHumanId: userId,
|
||||
visibleTo,
|
||||
@@ -342,6 +346,13 @@ export function ComposeOverlay({
|
||||
|
||||
switch (currentStep) {
|
||||
case "idle": {
|
||||
if (disabledRef.current) {
|
||||
if ((e.key === "`" && !e.repeat) || e.key === "t" || e.key === "T") {
|
||||
e.preventDefault();
|
||||
toast.info("This stream is closed");
|
||||
}
|
||||
break;
|
||||
}
|
||||
if (e.key === "`" && !e.repeat) {
|
||||
e.preventDefault();
|
||||
recordStartRef.current = Date.now();
|
||||
|
||||
Reference in New Issue
Block a user