Skip to content

Commit

Permalink
Revert "New Snap Settings UI updated done (#1296)"
Browse files Browse the repository at this point in the history
This reverts commit 9d40a73.
  • Loading branch information
abhishek-01k authored Nov 7, 2023
1 parent 5da316c commit bc00932
Showing 1 changed file with 54 additions and 16 deletions.
70 changes: 54 additions & 16 deletions src/components/userSettings/UserSettings.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,6 @@ import ManageNotifSettingDropdown from 'components/dropdowns/ManageNotifSettingD

// Internal Configs
import { device } from 'config/Globals';
import ChannelListSettings from 'components/channel/ChannelListSettings';
import PushSnapSettings from 'components/MetamaskSnap/PushSnapSettings';
import EmptyNotificationSettings from 'components/channel/EmptyNotificationSettings';

interface ChannelListItem {
Expand All @@ -36,7 +34,6 @@ function UserSettings() {
const { account, chainId } = useAccount();
const { subscriptionStatus, userSettings: currentUserSettings } = useSelector((state: any) => state.channels);
const [selectedOption, setSelectedOption] = useState(0);

const [channelList, setChannelList] = useState<ChannelListItem[]>([]);
const [isLoading, setIsLoading] = useState(true);

Expand Down Expand Up @@ -104,16 +101,12 @@ function UserSettings() {
{
value: 0,
label: 'Notification Settings',
title:'Notification Settings'
},
{
value: 1,
label: 'Push Snap',
title: ''
}
];


const userSettings = useMemo(() => {
return cloneDeep(currentUserSettings);
}, [currentUserSettings]);

return (
<Container>
Expand All @@ -133,11 +126,56 @@ function UserSettings() {
</SelectSection>
<ChannelWrapper>
<ChannelContainer>
{selectOptions[selectedOption]?.title && <SectionTitle>{selectOptions[selectedOption]?.title}</SectionTitle>}

{selectedOption === 0 && <ChannelListSettings />}
{selectedOption === 1 && <PushSnapSettings />}

<SectionTitle>{selectOptions[selectedOption].label}</SectionTitle>
<>
{isLoading ? (
<CenterContainer>
<LoaderSpinner />
</CenterContainer>
) : (
<>
{channelList.length > 0 ? (
channelList.map((channel, index) => (
<>
{channel && (
<>
<SettingsListItem key={channel.id}>
<SettingsListRow>
<Icon src={channel.icon} />
<ChannelName>{channel.name}</ChannelName>
</SettingsListRow>
<ManageNotifSettingDropdown
userSetting={userSettings[channel.channel]}
centerOnMobile={false}
channelDetail={channel}
onSuccessOptout={() => {
setChannelList((prevChannelList) =>
prevChannelList.filter((item) => item?.id !== channel.id)
);
}}
>
<MoreButtonUI />
</ManageNotifSettingDropdown>
</SettingsListItem>
{index !== channelList.length - 1 && <HR />}
</>
)}
</>
))
) : (
<CenterContainer>
<EmptyNotificationSettings
title="No Channel Opt-ins"
description="Opt-in channels to manage your notification preferences"
buttonTitle="Go to Channels"
onClick={navigateToChannels}
showTopBorder={false}
/>
</CenterContainer>
)}
</>
)}
</>
</ChannelContainer>
</ChannelWrapper>
</Wrapper>
Expand Down Expand Up @@ -209,7 +247,7 @@ const SelectSection = styled.div`
}
`;

const SelectListOption = styled(Button) <{ isSelected: boolean }>`
const SelectListOption = styled(Button)<{ isSelected: boolean }>`
background-color: ${(props) => (props.isSelected ? props.theme.default.secondaryBg : 'transparent')};
color: ${(props) => props.theme.default.secondaryColor};
border-radius: 12px;
Expand Down

0 comments on commit bc00932

Please sign in to comment.