Amount for Staking
@@ -115,7 +115,7 @@ const TabSpace = styled.div`
border-radius: 20px;
background-color: #f4f5fa;
align-items: center;
- transform: translateY(40px);
+ z-index: 1;
@media ${device.tablet} {
width: 100%;
diff --git a/src/modules/channelDashboard/channelDashboardModule.tsx b/src/modules/channelDashboard/channelDashboardModule.tsx
index 7b09a56982..fa0c72da2d 100644
--- a/src/modules/channelDashboard/channelDashboardModule.tsx
+++ b/src/modules/channelDashboard/channelDashboardModule.tsx
@@ -60,7 +60,7 @@ const Container = styled(Section)`
100% - ${globalsMargin.MINI_MODULES.DESKTOP.RIGHT} - ${globalsMargin.MINI_MODULES.DESKTOP.LEFT} -
${GLOBALS.ADJUSTMENTS.PADDING.HUGE} - ${GLOBALS.ADJUSTMENTS.PADDING.HUGE}
);
- padding: ${GLOBALS.ADJUSTMENTS.PADDING.HUGE};
+ padding: ${GLOBALS.ADJUSTMENTS.PADDING.DEFAULT};
position: relative;
margin: ${GLOBALS.ADJUSTMENTS.MARGIN.MINI_MODULES.DESKTOP};
diff --git a/src/modules/editChannel/EditChannel.tsx b/src/modules/editChannel/EditChannel.tsx
index ea558e4e05..411d40530c 100644
--- a/src/modules/editChannel/EditChannel.tsx
+++ b/src/modules/editChannel/EditChannel.tsx
@@ -533,6 +533,7 @@ const Footer = styled(ItemVV2)`
justify-content: space-between;
grid-gap: 40px;
margin-top:35px;
+ z-index: 1;
@media (max-width:600px){
padding: 16px;
From a43adab3f3f5af6ad7041a94fa5179df870d744e Mon Sep 17 00:00:00 2001
From: kalashshah <202051096@iiitvadodara.ac.in>
Date: Tue, 3 Oct 2023 17:34:33 +0530
Subject: [PATCH 08/10] chore: update url to notif settings page
---
src/components/ChannelDetails.js | 2 +-
src/components/channel/ChannelInfoList.tsx | 2 +-
src/modules/notifSettings/NotifSettingsModule.tsx | 2 +-
src/structure/MasterInterfacePage.tsx | 2 +-
4 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/src/components/ChannelDetails.js b/src/components/ChannelDetails.js
index 352a897dae..9f02e70b8d 100644
--- a/src/components/ChannelDetails.js
+++ b/src/components/ChannelDetails.js
@@ -147,7 +147,7 @@ export default function ChannelDetails({ isChannelExpired, setIsChannelExpired,
};
const navigateToNotifSettings = () => {
- navigate('/notif-settings');
+ navigate('/channel/settings');
};
return (
diff --git a/src/components/channel/ChannelInfoList.tsx b/src/components/channel/ChannelInfoList.tsx
index 3294760cc4..12a97af4a8 100644
--- a/src/components/channel/ChannelInfoList.tsx
+++ b/src/components/channel/ChannelInfoList.tsx
@@ -44,7 +44,7 @@ const ChannelInfoList = (props: ChannelInfoListProps) => {
const navigate = useNavigate();
const handleNavigateToModifySettings = () => {
- navigate(`/notif-settings`);
+ navigate(`/channel/settings`);
};
return (
diff --git a/src/modules/notifSettings/NotifSettingsModule.tsx b/src/modules/notifSettings/NotifSettingsModule.tsx
index 330d6d6843..59254f1418 100644
--- a/src/modules/notifSettings/NotifSettingsModule.tsx
+++ b/src/modules/notifSettings/NotifSettingsModule.tsx
@@ -19,7 +19,7 @@ export const ALLOWED_CORE_NETWORK = appConfig.coreContractChain; //chainId of ne
// Create Header
function NotifSettingsPage() {
- ReactGA.pageview('/notif-settings');
+ ReactGA.pageview('/channel/settings');
// toast related section
const [toast, showToast] = React.useState(null);
diff --git a/src/structure/MasterInterfacePage.tsx b/src/structure/MasterInterfacePage.tsx
index d472bd59be..56f0ead8df 100644
--- a/src/structure/MasterInterfacePage.tsx
+++ b/src/structure/MasterInterfacePage.tsx
@@ -98,7 +98,7 @@ function MasterInterfacePage() {
} />
} />
} />
- } />
+ } />
} />
} />
From 5ae98de584ca16c6b75e257de20adf72b67312f1 Mon Sep 17 00:00:00 2001
From: kalashshah <202051096@iiitvadodara.ac.in>
Date: Thu, 5 Oct 2023 14:28:22 +0530
Subject: [PATCH 09/10] feat: get channel service
---
src/services/channels/getChannel.ts | 19 +++++++++++++++++++
src/services/channels/index.ts | 3 ++-
2 files changed, 21 insertions(+), 1 deletion(-)
create mode 100644 src/services/channels/getChannel.ts
diff --git a/src/services/channels/getChannel.ts b/src/services/channels/getChannel.ts
new file mode 100644
index 0000000000..ce3ebd2ebc
--- /dev/null
+++ b/src/services/channels/getChannel.ts
@@ -0,0 +1,19 @@
+// External Packages
+import * as PushAPI from '@pushprotocol/restapi';
+
+// Internal Configs
+import { appConfig } from 'config';
+
+// Types
+type Props = {
+ channel: string;
+};
+
+export const getChannel = async ({ channel }: Props) => {
+ try {
+ return await PushAPI.channels.getChannel({ channel, env: appConfig.appEnv });
+ } catch (err) {
+ console.error(err);
+ throw new Error(err.message);
+ }
+};
diff --git a/src/services/channels/index.ts b/src/services/channels/index.ts
index 9073c8ed58..03752f1c6c 100644
--- a/src/services/channels/index.ts
+++ b/src/services/channels/index.ts
@@ -1,3 +1,4 @@
export * from "./getChannelDelegates";
export * from "./getChannels";
-export * from "./getChannelsSearch";
\ No newline at end of file
+export * from "./getChannelsSearch";
+export * from "./getChannel";
From 1ea7ae02db62428889a00d4d1baec3cc79056d6a Mon Sep 17 00:00:00 2001
From: kalashshah <202051096@iiitvadodara.ac.in>
Date: Thu, 5 Oct 2023 14:28:50 +0530
Subject: [PATCH 10/10] chore: fix styling and add fixed price for nfs
---
.../channel/AddSettingModalContent.tsx | 8 +-
src/components/channel/ChannelButtons.tsx | 12 +--
src/components/channel/ChannelInfoList.tsx | 7 +-
src/components/channel/DepositFeeFooter.tsx | 85 ++++++++-----------
.../channel/NotificationSettings.tsx | 33 ++++---
src/config/Themization.js | 8 ++
6 files changed, 74 insertions(+), 79 deletions(-)
diff --git a/src/components/channel/AddSettingModalContent.tsx b/src/components/channel/AddSettingModalContent.tsx
index df363676d3..bebae1afd3 100644
--- a/src/components/channel/AddSettingModalContent.tsx
+++ b/src/components/channel/AddSettingModalContent.tsx
@@ -324,7 +324,7 @@ const ModalContainer = styled.div`
}
`;
-const Label = styled.div`
+const Label = styled.div<{ padding?: string }>`
font-style: normal;
font-weight: 500;
font-size: 16px;
@@ -347,13 +347,13 @@ const MaxWidthInput = styled(Input)<{ hasError: boolean }>`
max-width: 108px;
flex: 1;
border: ${(props) =>
- props.hasError ? `1px solid rgba(237, 88, 88, 1)` : `1px solid ${props.theme.default.borderColor}`};
+ props.hasError ? `1px solid ${props.theme.nfsError}` : `1px solid ${props.theme.default.borderColor}`};
`;
const InputWithError = styled(Input)<{ hasError: boolean }>`
flex: 1;
border: ${(props) =>
- props.hasError ? `1px solid rgba(237, 88, 88, 1)` : `1px solid ${props.theme.default.borderColor}`};
+ props.hasError ? `1px solid ${props.theme.nfsError}` : `1px solid ${props.theme.default.borderColor}`};
`;
const ErrorInfo = styled.span`
@@ -362,7 +362,7 @@ const ErrorInfo = styled.span`
line-height: 18px;
letter-spacing: 0em;
text-align: left;
- color: rgba(237, 88, 88, 1);
+ color: ${(props) => props.theme.nfsError};
margin-top: 4px;
`;
diff --git a/src/components/channel/ChannelButtons.tsx b/src/components/channel/ChannelButtons.tsx
index 72d6e5d3a8..53b2a2602b 100644
--- a/src/components/channel/ChannelButtons.tsx
+++ b/src/components/channel/ChannelButtons.tsx
@@ -47,28 +47,23 @@ export const AddSettingButton = ({ onClick }: ChannelButtonProps) => {
const ChannelButton = styled(Button)`
height: 36px;
- background: #cf1c84;
+ background: ${(props) => props.theme.default.primaryPushThemeTextColor};
color: #fff;
z-index: 0;
- font-family: 'Strawford';
font-style: normal;
font-weight: 500;
font-size: 14px;
line-height: 17px;
border-radius: 8px;
padding: 4px 12px 4px 12px;
- @media (min-width: 600px) and (max-width: 700px) {
- margin-right: 9px;
- }
`;
const ChannelButtonWhite = styled.button`
height: 36px;
border: 1px solid ${(props) => props.theme.default.borderColor};
background: transparent;
- color: #fff;
+ color: white;
z-index: 0;
- font-family: 'Strawford';
font-style: normal;
font-weight: 500;
font-size: 14px;
@@ -76,9 +71,6 @@ const ChannelButtonWhite = styled.button`
border-radius: 8px;
padding: 4px 12px 4px 12px;
cursor: pointer;
- @media (min-width: 600px) and (max-width: 700px) {
- margin-right: 9px;
- }
`;
const ButtonText = styled.span`
diff --git a/src/components/channel/ChannelInfoList.tsx b/src/components/channel/ChannelInfoList.tsx
index 12a97af4a8..84210415cf 100644
--- a/src/components/channel/ChannelInfoList.tsx
+++ b/src/components/channel/ChannelInfoList.tsx
@@ -149,14 +149,16 @@ const DelegatesList = styled.div<{ isLoading: boolean }>`
const Tag = styled.div`
padding: 4px 8px 4px 8px;
border-radius: 4px;
- background-color: rgba(244, 245, 250, 1);
- color: rgba(73, 77, 95, 1);
+ background-color: ${(props) => props.theme.default.secondaryBg};
+ color: ${(props) => props.theme.tooltipContentDesc};
font-size: 10px;
margin-left: 8px;
`;
const NotificationSettingName = styled.span`
margin-left: 15px;
+ color: ${(props) =>
+ props.theme.scheme === 'light' ? props.theme.default.color : props.theme.default.secondaryColor};
`;
const EmptyNotificationSetting = styled.div`
@@ -169,7 +171,6 @@ const EmptyNotificationSetting = styled.div`
`;
const EmptyNotificationTitle = styled.div`
- font-family: Strawford;
font-size: 16px;
font-weight: 500;
line-height: 24px;
diff --git a/src/components/channel/DepositFeeFooter.tsx b/src/components/channel/DepositFeeFooter.tsx
index c53141066d..30f49a8480 100644
--- a/src/components/channel/DepositFeeFooter.tsx
+++ b/src/components/channel/DepositFeeFooter.tsx
@@ -27,30 +27,17 @@ interface DepositFeeFooterProps {
onCancel: () => void;
disabled: boolean;
onClick: () => void;
+ feeRequired: number;
}
-const DepositFeeFooter = ({ title, description, onCancel, disabled, onClick }: DepositFeeFooterProps) => {
+const DepositFeeFooter = ({ title, description, onCancel, disabled, onClick, feeRequired }: DepositFeeFooterProps) => {
const { account, provider } = useAccount();
- const { epnsReadProvider } = useSelector((state: any) => state.contracts);
- const [feesRequiredForEdit, setFeesRequiredForEdit] = useState(0);
const [pushApprovalAmount, setPushApprovalAmount] = useState(0);
const [pushDeposited, setPushDeposited] = useState(false);
const [isLoading, setIsLoading] = useState(false);
- // it can be fetched from contract for dynamic, but making it const will be fast
- const minFees = 50;
-
const depositFeeToast = useToast();
- useEffect(() => {
- if (!account) return;
-
- (async function () {
- const amount = await epnsReadProvider.channelUpdateCounter(account);
- setFeesRequiredForEdit(minFees * (Number(amount) + 1));
- })();
- }, [account]);
-
useEffect(() => {
if (!account || !provider) return;
@@ -63,7 +50,7 @@ const DepositFeeFooter = ({ title, description, onCancel, disabled, onClick }: D
setPushApprovalAmount(parseInt(pushTokenApprovalAmount));
const amountToBeDeposit = parseInt(pushTokenApprovalAmount);
- if (amountToBeDeposit >= feesRequiredForEdit && amountToBeDeposit != 0) {
+ if (amountToBeDeposit >= feeRequired && amountToBeDeposit != 0) {
setPushDeposited(true);
} else {
setPushDeposited(false);
@@ -80,12 +67,12 @@ const DepositFeeFooter = ({ title, description, onCancel, disabled, onClick }: D
const response = await approvePushToken({
signer,
contractAddress: addresses.epnscore,
- amount: feesRequiredForEdit - pushApprovalAmount,
+ amount: feeRequired - pushApprovalAmount,
});
console.log('response', response);
if (response) {
setIsLoading(false);
- setPushApprovalAmount(feesRequiredForEdit);
+ setPushApprovalAmount(feeRequired);
setPushDeposited(true);
depositFeeToast.showMessageToast({
toastTitle: 'Success',
@@ -143,11 +130,11 @@ const DepositFeeFooter = ({ title, description, onCancel, disabled, onClick }: D
{pushDeposited ? : null}
- {feesRequiredForEdit} PUSH
+ {feeRequired} PUSH
{
await mintPushToken({ noOfTokens, provider, account });
@@ -170,18 +157,27 @@ const DepositFeeFooter = ({ title, description, onCancel, disabled, onClick }: D
<>
{/* This below is Footer Buttons i.e, Cancel and save changes */}
- Cancel
-
- {pushApprovalAmount >= feesRequiredForEdit ? (
+
+ Cancel
+
+
+ {pushApprovalAmount >= feeRequired ? (
Save Changes
) : (
- Approve PUSH
+
+ Approve PUSH
+
)}
>
@@ -220,7 +216,6 @@ const Footer = styled(ItemVV2)`
const FooterPrimaryText = styled.p`
margin: 0px;
color: ${(props) => props.theme.editChannelPrimaryText};
- font-family: 'Strawford';
font-style: normal;
font-weight: 500;
font-size: 20px;
@@ -237,8 +232,7 @@ const FooterSecondaryText = styled.p`
const EditFee = styled.p`
margin: 0px 0px 0px 5px;
- color: #d53893;
- font-family: 'Strawford';
+ color: ${(props) => props.theme.viewChannelSecondaryText};
font-style: normal;
font-weight: 500;
font-size: 20px;
@@ -255,7 +249,6 @@ const VerifyingContainer = styled(ItemVV2)`
`;
const TransactionText = styled.p`
- font-family: 'Strawford';
font-style: normal;
font-weight: 500;
font-size: 18px;
@@ -275,8 +268,7 @@ const ButtonContainer = styled(ItemHV2)`
}
`;
-const FooterButtons = styled(Button)`
- font-family: 'Strawford';
+const FooterButtons = styled(Button)<{ disabled: boolean }>`
font-style: normal;
font-weight: 500;
font-size: 18px;
@@ -285,8 +277,8 @@ const FooterButtons = styled(Button)`
border-radius: 15px;
align-items: center;
text-align: center;
- background: #cf1c84;
- color: #fff;
+ background: ${(props) => (props.disabled ? props.theme.nfsDisabled : props.theme.default.primaryPushThemeTextColor)};
+ color: ${(props) => (props.disabled ? props.theme.nfsDisabledText : 'white')};
padding: 16px 27px;
width: 12rem;
@@ -302,23 +294,16 @@ const FooterButtons = styled(Button)`
`;
const CancelButtons = styled(FooterButtons)`
- margin-right:14px;
- background:${(props) => props.theme.default.bg};
- color:${(props) => props.theme.logoBtnColor};
- border:1px solid #CF1C84;
- @media (max-width:425px){
- margin-right:0px;
- margin-top:10px;
- }
+ margin-right: 14px;
+ background: ${(props) => props.theme.default.bg};
+ color: ${(props) => props.theme.logoBtnColor};
+ border: 1px solid ${(props) =>
+ props.theme.scheme === 'light'
+ ? props.theme.default.primaryPushThemeTextColor
+ : props.theme.default.borderColor};
- &:hover{
- color:#AC106C;
- border:border: 1px solid #AC106C;
- background:transparent;
- opacity:1;
- }
-
- &:after{
- background:white;
+ @media ${device.mobileL} {
+ margin-right: 0px;
+ margin-top: 10px;
}
`;
diff --git a/src/components/channel/NotificationSettings.tsx b/src/components/channel/NotificationSettings.tsx
index 30026ce5d0..cd68c06845 100644
--- a/src/components/channel/NotificationSettings.tsx
+++ b/src/components/channel/NotificationSettings.tsx
@@ -24,21 +24,18 @@ import { useAccount } from 'hooks';
import { appConfig } from 'config';
import useModalBlur, { MODAL_POSITION } from 'hooks/useModalBlur';
import { ChannelSetting } from 'helpers/channel/types';
+import { getChannel } from 'services';
// Constants
const CORE_CHAIN_ID = appConfig.coreContractChain;
function NotificationSettings() {
const { account, chainId } = useAccount();
- const {
- coreChannelAdmin,
- channelDetails,
- delegatees,
- aliasDetails: { aliasEthAddr },
- } = useSelector((state: any) => state.admin);
+ const { coreChannelAdmin, delegatees } = useSelector((state: any) => state.admin);
const { epnsWriteProvider } = useSelector((state: any) => state.contracts);
const onCoreNetwork = CORE_CHAIN_ID === chainId;
+ const EDIT_SETTING_FEE = 50;
const [channelAddress, setChannelAddress] = React.useState('');
const [settings, setSettings] = React.useState([]);
@@ -53,14 +50,25 @@ function NotificationSettings() {
ModalComponent: AddSettingModal,
} = useModalBlur();
+ const redirectBack = () => {
+ const url = window.location.origin;
+ window.location.replace(`${url}/channels`);
+ };
+
useEffect(() => {
// Is not the channel admin so cannot edit settings
- setIsLoading(true);
- if (coreChannelAdmin && account && coreChannelAdmin !== account) {
- const url = window.location.origin;
- window.location.replace(`${url}/channels`);
- }
- setIsLoading(false);
+ (async () => {
+ setIsLoading(true);
+ if (!account) return;
+ try {
+ const channelDetails = await getChannel({ channel: account });
+ if (!channelDetails) redirectBack();
+ } catch {
+ redirectBack();
+ }
+ if (coreChannelAdmin && coreChannelAdmin !== account) redirectBack();
+ setIsLoading(false);
+ })();
}, [account, coreChannelAdmin]);
useEffect(() => {
@@ -257,6 +265,7 @@ function NotificationSettings() {
]}
/>