From ff63a4efc8c1d47475698dc0832c49e54ab06ce6 Mon Sep 17 00:00:00 2001 From: Adil Mustafa Date: Thu, 3 Oct 2024 17:54:47 +0500 Subject: [PATCH] feat(stories): add ability to start playing stories from a specific story index (#113) --- src/components/InstagramStories/index.tsx | 1 + src/components/Modal/index.tsx | 1 + src/core/dto/componentsDTO.ts | 4 ++++ src/core/dto/instagramStoriesDTO.ts | 4 ++++ 4 files changed, 10 insertions(+) diff --git a/src/components/InstagramStories/index.tsx b/src/components/InstagramStories/index.tsx index ab743de..4a3f991 100644 --- a/src/components/InstagramStories/index.tsx +++ b/src/components/InstagramStories/index.tsx @@ -175,6 +175,7 @@ const InstagramStories = forwardRefmodalRef.current?.goToSpecificStory(userId,index), hide: () => modalRef.current?.hide(), show: ( id ) => { diff --git a/src/components/Modal/index.tsx b/src/components/Modal/index.tsx index 4ce9fa8..2392a8e 100644 --- a/src/components/Modal/index.tsx +++ b/src/components/Modal/index.tsx @@ -423,6 +423,7 @@ const StoryModal = forwardRef( ( { getCurrentStory: () => ( { userId: userId.value, storyId: currentStory.value } ), goToPreviousStory: toPreviousStory, goToNextStory: toNextStory, + goToSpecificStory:(userId:string,index:number)=>{scrollTo(userId, true, false, undefined, index)}, } ), [ userId.value, currentStory.value ] ); useEffect( () => { diff --git a/src/core/dto/componentsDTO.ts b/src/core/dto/componentsDTO.ts index 10b738a..23d4e61 100644 --- a/src/core/dto/componentsDTO.ts +++ b/src/core/dto/componentsDTO.ts @@ -63,6 +63,10 @@ export type StoryModalPublicMethods = { goToPreviousStory: () => void; goToNextStory: () => void; getCurrentStory: () => { userId?: string, storyId?: string }; + goToSpecificStory:( + userId?: string, + index?: number, + )=>void; }; export type GestureContext = { diff --git a/src/core/dto/instagramStoriesDTO.ts b/src/core/dto/instagramStoriesDTO.ts index a37bf7e..bd23e94 100644 --- a/src/core/dto/instagramStoriesDTO.ts +++ b/src/core/dto/instagramStoriesDTO.ts @@ -94,4 +94,8 @@ export type InstagramStoriesPublicMethods = { goToPreviousStory: () => void; goToNextStory: () => void; getCurrentStory: () => { userId?: string, storyId?: string }; + goToSpecificStory:( + userId?: string, + index?: number, + )=>void; };