Skip to content

Commit

Permalink
Fix tabs (#91)
Browse files Browse the repository at this point in the history
  • Loading branch information
Redm4x authored Jan 31, 2024
1 parent 7becb4f commit f829921
Showing 1 changed file with 42 additions and 41 deletions.
83 changes: 42 additions & 41 deletions deploy-web/src/components/user/UserProfileLayout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -90,47 +90,48 @@ export const UserProfileLayout: React.FunctionComponent<Props> = ({ page, childr
}}
/>

{user?.username === username && (
<>
{/** Only show favorites/address book/settings for current user */}
<Tab
value="favorites"
label="Favorites"
{...a11yTabProps("favorites-tab", "favorites-panel", 1)}
classes={{ selected: classes.selectedTab }}
onClick={() => {
event(AnalyticsEvents.USER_PROFILE_FAVORITES_TAB, {
category: "profile",
label: "Click on favorites tab"
});
}}
/>
<Tab
value="address-book"
label="Address Book"
{...a11yTabProps("address-book-tab", "address-book-tab-panel", 1)}
classes={{ selected: classes.selectedTab }}
onClick={() => {
event(AnalyticsEvents.USER_PROFILE_ADDRESS_BOOK_TAB, {
category: "profile",
label: "Click on address book tab"
});
}}
/>
<Tab
value="settings"
label="Settings"
{...a11yTabProps("settings-tab", "settings-panel", 1)}
classes={{ selected: classes.selectedTab }}
onClick={() => {
event(AnalyticsEvents.USER_PROFILE_SETTINGS_TAB, {
category: "profile",
label: "Click on settings tab"
});
}}
/>
</>
)}
{/** Only show favorites/address book/settings for current user */}
{user?.username === username && [
<Tab
key="favorites"
value="favorites"
label="Favorites"
{...a11yTabProps("favorites-tab", "favorites-panel", 1)}
classes={{ selected: classes.selectedTab }}
onClick={() => {
event(AnalyticsEvents.USER_PROFILE_FAVORITES_TAB, {
category: "profile",
label: "Click on favorites tab"
});
}}
/>,
<Tab
key="address-book"
value="address-book"
label="Address Book"
{...a11yTabProps("address-book-tab", "address-book-tab-panel", 1)}
classes={{ selected: classes.selectedTab }}
onClick={() => {
event(AnalyticsEvents.USER_PROFILE_ADDRESS_BOOK_TAB, {
category: "profile",
label: "Click on address book tab"
});
}}
/>,
<Tab
key="settings"
value="settings"
label="Settings"
{...a11yTabProps("settings-tab", "settings-panel", 1)}
classes={{ selected: classes.selectedTab }}
onClick={() => {
event(AnalyticsEvents.USER_PROFILE_SETTINGS_TAB, {
category: "profile",
label: "Click on settings tab"
});
}}
/>
]}
</Tabs>
</Box>

Expand Down

0 comments on commit f829921

Please sign in to comment.