Skip to content

Commit

Permalink
deeplink album sharing tabs (#399)
Browse files Browse the repository at this point in the history
  • Loading branch information
sickelap authored Nov 6, 2023
1 parent 0294be4 commit 799be1a
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
5 changes: 3 additions & 2 deletions src/layouts/sharing/SharedFromMe.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Group, Stack, Tabs, Text, Title } from "@mantine/core";
import React, { useEffect } from "react";
import { useParams } from "react-router-dom";
import { useNavigate, useParams } from "react-router-dom";

import { fetchUserAlbumsSharedFromMe } from "../../actions/albumsActions";
import { fetchPhotosSharedFromMe } from "../../actions/photosActions";
Expand All @@ -12,6 +12,7 @@ import { PhotosShared } from "./PhotosShared";

export function SharedFromMe() {
const dispatch = useAppDispatch();
const navigate = useNavigate();
const { albums } = useAppSelector(store => store);
const { photosFlat, photosGroupedByUser, fetchedPhotosetType } = useAppSelector(store => store.photos);
const { which } = useParams();
Expand Down Expand Up @@ -45,7 +46,7 @@ export function SharedFromMe() {
</Text>
</div>
</Group>
<Tabs defaultValue="photos">
<Tabs defaultValue={which} onTabChange={value => navigate(`/shared/fromme/${value}/`)}>
<Tabs.List>
<Tabs.Tab value="photos">Photos</Tabs.Tab>
<Tabs.Tab value="albums">Albums</Tabs.Tab>
Expand Down
5 changes: 3 additions & 2 deletions src/layouts/sharing/SharedToMe.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Group, Stack, Tabs, Text, Title } from "@mantine/core";
import React, { useEffect } from "react";
import { useParams } from "react-router-dom";
import { useNavigate, useParams } from "react-router-dom";

import { fetchUserAlbumsSharedToMe } from "../../actions/albumsActions";
import { fetchPhotosSharedToMe } from "../../actions/photosActions";
Expand All @@ -12,6 +12,7 @@ import { PhotosShared } from "./PhotosShared";

export function SharedToMe() {
const dispatch = useAppDispatch();
const navigate = useNavigate();
const { albums } = useAppSelector(store => store);
const { photosFlat, photosGroupedByUser, fetchedPhotosetType } = useAppSelector(store => store.photos);
const { which } = useParams();
Expand Down Expand Up @@ -52,7 +53,7 @@ export function SharedToMe() {
</Text>
</div>
</Group>
<Tabs defaultValue="photos">
<Tabs defaultValue={which} onTabChange={value => navigate(`/shared/tome/${value}/`)}>
<Tabs.List>
<Tabs.Tab value="photos">Photos</Tabs.Tab>
<Tabs.Tab value="albums">Albums</Tabs.Tab>
Expand Down

0 comments on commit 799be1a

Please sign in to comment.