22
33import type { VideoMetadata } from "@cap/database/types" ;
44import { Button } from "@cap/ui" ;
5- import type { Video } from "@cap/web-domain" ;
5+ import type { ImageUpload , Video } from "@cap/web-domain" ;
66import { faFolderPlus , faInfoCircle } from "@fortawesome/free-solid-svg-icons" ;
77import { FontAwesomeIcon } from "@fortawesome/react-fontawesome" ;
88import { Effect , Exit } from "effect" ;
99import { useRouter , useSearchParams } from "next/navigation" ;
1010import { useEffect , useMemo , useRef , useState } from "react" ;
1111import { toast } from "sonner" ;
12- import { useEffectMutation } from "@/lib/EffectRuntime" ;
12+ import { useEffectMutation , useRpcClient } from "@/lib/EffectRuntime" ;
1313import { useVideosAnalyticsQuery } from "@/lib/Queries/Analytics" ;
14- import { AnalyticsRequest } from "@/lib/Requests/AnalyticsRequest" ;
15- import { Rpc , withRpc } from "@/lib/Rpcs" ;
1614import { useDashboardContext } from "../Contexts" ;
1715import {
1816 NewFolderDialog ,
@@ -36,11 +34,14 @@ export type VideoData = {
3634 totalComments : number ;
3735 totalReactions : number ;
3836 foldersData : FolderDataType [ ] ;
39- sharedOrganizations : { id : string ; name : string ; iconUrl ?: string } [ ] ;
37+ sharedOrganizations : {
38+ id : string ;
39+ name : string ;
40+ iconUrl ?: ImageUpload . ImageUrl | null ;
41+ } [ ] ;
4042 sharedSpaces ?: {
4143 id : string ;
4244 name : string ;
43- iconUrl : string ;
4445 isOrg : boolean ;
4546 organizationId : string ;
4647 } [ ] ;
@@ -147,12 +148,12 @@ export const Caps = ({
147148 } ) ;
148149 } ;
149150
151+ const rpc = useRpcClient ( ) ;
152+
150153 const { mutate : deleteCaps , isPending : isDeletingCaps } = useEffectMutation ( {
151154 mutationFn : Effect . fn ( function * ( ids : Video . VideoId [ ] ) {
152155 if ( ids . length === 0 ) return ;
153156
154- const rpc = yield * Rpc ;
155-
156157 const fiber = yield * Effect . gen ( function * ( ) {
157158 const results = yield * Effect . all (
158159 ids . map ( ( id ) => rpc . VideoDelete ( id ) . pipe ( Effect . exit ) ) ,
@@ -203,7 +204,7 @@ export const Caps = ({
203204 } ) ;
204205
205206 const { mutate : deleteCap , isPending : isDeletingCap } = useEffectMutation ( {
206- mutationFn : ( id : Video . VideoId ) => withRpc ( ( r ) => r . VideoDelete ( id ) ) ,
207+ mutationFn : ( id : Video . VideoId ) => rpc . VideoDelete ( id ) ,
207208 onSuccess : ( ) => {
208209 toast . success ( "Cap deleted successfully" ) ;
209210 router . refresh ( ) ;
0 commit comments