Skip to content

Commit

Permalink
feat: add landing page tab customization in SettingsTabs.tsx
Browse files Browse the repository at this point in the history
  • Loading branch information
Louis-htmlcss committed Sep 5, 2024
1 parent 1e4eb8f commit d1d8e27
Showing 1 changed file with 53 additions and 0 deletions.
53 changes: 53 additions & 0 deletions src/views/settings/SettingsTabs.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,15 @@ const SettingsTabs = () => {

const [previewIndex, setPreviewIndex] = useState(0);

const [landingTab, setLandingTab] = useState(account.personalization.landingTab || "Home");

useEffect(() => {
mutateProperty("personalization", {
...account.personalization,
landingTab,
});
}, [landingTab]);

return (
<View>
<NestableScrollContainer
Expand Down Expand Up @@ -457,6 +466,50 @@ const SettingsTabs = () => {
</NativeText>
</NativeItem>
</NativeList>

<NativeListHeader
label="Page de démarrage"
/>

<NativeList>
{tabs.filter(tab => tab.enabled).map((tab) => (
<NativeItem
key={tab.tab}
onPress={() => setLandingTab(tab.tab)}
leading={
<LottieView
source={tab.icon}
colorFilters={[{
keypath: "*",
color: landingTab === tab.tab ? theme.colors.primary : theme.colors.text,
}]}
style={{
width: 24,
height: 24,
marginVertical: 2,
}}
/>
}
trailing={
<Reanimated.View
entering={ZoomIn.springify().mass(1).damping(20).stiffness(300)}
exiting={ZoomOut.duration(300)}
>
<PapillonCheckbox
checked={landingTab === tab.tab}
onPress={() => setLandingTab(tab.tab)}
/>
</Reanimated.View>
}
>
<NativeText variant="title" style={{
color: landingTab === tab.tab ? theme.colors.primary : theme.colors.text,
}}>
{tab.label}
</NativeText>
</NativeItem>
))}
</NativeList>
</View>
</NestableScrollContainer>
</View>
Expand Down

0 comments on commit d1d8e27

Please sign in to comment.