feat: stream list view and tasks (#279)
* first attempt at stream sidebar, tasks, and events * fix folder from root * cleanup folders and events, and condense changes * cleanup and add toggle for sidebar * cleanup * fix nits
This commit was merged in pull request #279.
This commit is contained in:
@@ -2,21 +2,25 @@ import { useCallback, useState } from 'react';
|
||||
import { toast } from 'sonner';
|
||||
import { ConfirmDestructiveOverlay } from '@/components/confirm-destructive-overlay';
|
||||
import { softDeleteParticle } from '@/lib/firestore-particles';
|
||||
import { particlePath, toFirestoreDocPath } from '@/lib/particle-path';
|
||||
import {
|
||||
particlePath,
|
||||
parseParticlePath,
|
||||
toFirestoreDocPath,
|
||||
type ParticlePath,
|
||||
} from '@/lib/particle-path';
|
||||
import type { Particle } from '@/api/types';
|
||||
import { useSuspendPlayback } from '@/hooks/use-suspend-playback';
|
||||
|
||||
interface DeleteParticleOverlayProps {
|
||||
networkId: string;
|
||||
streamId: string;
|
||||
/** Path of the stream the particle lives in — may be nested. */
|
||||
streamPath: ParticlePath;
|
||||
particle: Particle;
|
||||
userId: string;
|
||||
onClose: () => void;
|
||||
}
|
||||
|
||||
export function DeleteParticleOverlay({
|
||||
networkId,
|
||||
streamId,
|
||||
streamPath,
|
||||
particle,
|
||||
userId,
|
||||
onClose,
|
||||
@@ -29,8 +33,9 @@ export function DeleteParticleOverlay({
|
||||
if (deleting) return;
|
||||
setDeleting(true);
|
||||
try {
|
||||
const { networkId, segments } = parseParticlePath(streamPath);
|
||||
const docPath = toFirestoreDocPath(
|
||||
particlePath(networkId, [streamId, particle.id]),
|
||||
particlePath(networkId, [...segments, particle.id]),
|
||||
);
|
||||
await softDeleteParticle(docPath, userId);
|
||||
toast.success('Particle deleted');
|
||||
@@ -41,7 +46,7 @@ export function DeleteParticleOverlay({
|
||||
toast.error(message);
|
||||
setDeleting(false);
|
||||
}
|
||||
}, [deleting, networkId, onClose, particle.id, streamId, userId]);
|
||||
}, [deleting, onClose, particle.id, streamPath, userId]);
|
||||
|
||||
return (
|
||||
<ConfirmDestructiveOverlay
|
||||
|
||||
Reference in New Issue
Block a user