Skip to content

Commit

Permalink
Merge pull request #83 from cd-sigma/main
Browse files Browse the repository at this point in the history
build
  • Loading branch information
cd-sigma committed Dec 9, 2023
2 parents 136c945 + e6f5b17 commit f85f924
Show file tree
Hide file tree
Showing 6 changed files with 40 additions and 18 deletions.
3 changes: 1 addition & 2 deletions frontend/src/components/ConnectWalltet/Walltet.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,7 @@ const ConnectWalletButton = ({
}}
disabled
>
<div style={{border:"1px solid white", fontSize:"30px",fontFamily:"Bebas neue",marginTop:"10px",borderRadius:"30px" , padding:"12px 20px",background:"white" , color:"black",
}}>Loading...</div>
Loading...
</div>
) : (
<div style={{border:"1px solid white", fontSize:"30px",fontFamily:"Bebas neue",marginTop:"10px",borderRadius:"30px" , padding:"12px 20px",background:"white" , color:"black",
Expand Down
4 changes: 1 addition & 3 deletions frontend/src/components/Navbar.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -41,16 +41,14 @@ const Navbar = () => {
onSubmit={(e) => {
e.preventDefault();
navigate(`/profile/${search}`);
console.log('search');
}}
onKeyDown={handleKeyDown}

/>
</div>
</div>

{/* Button on the Right */}
<Button color="inherit" sx={{border:"1px solid white"}}>Connect Wallet</Button>
{/* <Button color="inherit" sx={{border:"1px solid white"}}>Connect Wallet</Button> */}
</Toolbar>
</AppBar>
);
Expand Down
36 changes: 33 additions & 3 deletions frontend/src/components/Onboarding/Onboarding.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ const Onboarding = ({ open, setOpen, signer }) => {
const [selectedProtocols, setSelectedProtocols] = useState([]);
const [slackWebhook, setSlackWebhook] = useState('');
const [emailAddress, setEmailAddress] = useState('');
const [discordWebhook, setDiscordWebhook] = useState('');
const handleClose = () => {
setOpen(false);
};
Expand Down Expand Up @@ -35,6 +36,11 @@ const Onboarding = ({ open, setOpen, signer }) => {
event.stopPropagation();
setEmailAddress(event.target.value);
};
const handleDiscordWebhookChange = (event) => {
event.preventDefault();
event.stopPropagation();
setDiscordWebhook(event.target.value);
}

const handleNext = async () => {
if (selectedProtocols.includes('Slack') && !slackWebhook) {
Expand All @@ -43,7 +49,7 @@ const Onboarding = ({ open, setOpen, signer }) => {
}

selectedProtocols.includes('Slack') && axios.post('https://finsafe-backend.insidefi.io/alert/slack/subscribe', { webhook: slackWebhook }, { headers: { 'Content-Type': 'application/json', authorization: `Bearer ${localStorage.getItem('token')}` } });

selectedProtocols.includes('Discord') && axios.post('https://finsafe-backend.insidefi.io/alert/discord/subscribe', { webhook: discordWebhook }, { headers: { 'Content-Type': 'application/json', authorization: `Bearer ${localStorage.getItem('token')}` } });
if (selectedProtocols.includes('Email') && !emailAddress) {
alert('Please enter email address');
return;
Expand Down Expand Up @@ -82,7 +88,7 @@ const Onboarding = ({ open, setOpen, signer }) => {
width: '100%',
}}
>
<h2 style={{ marginBottom: '20px' }}>Select Push Protocols</h2>
<h2 style={{ marginBottom: '20px' }}>Select Alert Prefrences</h2>
<FormGroup>
<FormControlLabel
control={
Expand All @@ -93,7 +99,18 @@ const Onboarding = ({ open, setOpen, signer }) => {
value="Alerts"
/>
}
label="Alerts"
label="Push Protocol Alerts"
/>
<FormControlLabel
control={
<Checkbox
style={{ color: 'white' }}
checked={selectedProtocols.includes('Discord')}
onChange={handleProtocolChange}
value="Discord"
/>
}
label="Discord"
/>
<FormControlLabel
control={
Expand Down Expand Up @@ -131,6 +148,19 @@ const Onboarding = ({ open, setOpen, signer }) => {
/>
</div>
)}
{selectedProtocols.includes('Discord') && (
<div>
<TextField
label="Discord Webhook"
variant="outlined"
fullWidth
margin="normal"
value={discordWebhook}
onChange={(e) => handleDiscordWebhookChange(e)}
/>
</div>
)}


{selectedProtocols.includes('Email') && (
<div>
Expand Down
7 changes: 3 additions & 4 deletions frontend/src/components/PortfolioDetails.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,11 @@ import { useUserStore } from "../store/userStore";

import { getPortfolioDetails, getTokenDetails } from "../api/profile.api";

const PortfolioDetails = () => {
const PortfolioDetails = ({searchId}) => {
const [suppliedDetails, setSuppliedDetails] = useState([]);
const [borrowedDetails, setBorrowedDetails] = useState([]);
let userAddress = useUserStore((state) => state.userAddress);
userAddress = "0xb63e8a8d04999500a97470769d10c4395789836d";

const convertSuppliedToDesiredFormat = async (array) => {
try {
const result = await Promise.all(
Expand Down Expand Up @@ -73,7 +72,7 @@ const PortfolioDetails = () => {
};

const callApis = async () => {
const details = await getPortfolioDetails(userAddress);
const details = await getPortfolioDetails(searchId);
const { metadata } = details[0];
const { supplied, borrowed } = metadata;
const derivedSupplied = await convertSuppliedToDesiredFormat(supplied);
Expand All @@ -83,7 +82,7 @@ const PortfolioDetails = () => {
};
useEffect(() => {
callApis();
}, []);
}, [searchId]);
// console.log(suppliedDetails);
return (
<TableContainer component={Paper}>
Expand Down
3 changes: 2 additions & 1 deletion frontend/src/pages/ProfilePage.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ const ProfilePage = () => {
const handleTabChange = (event, newValue) => {
setCurrentTab(newValue);
};
const searchId=window.location.pathname.split('/')[2];

return (
<>
Expand Down Expand Up @@ -78,7 +79,7 @@ const ProfilePage = () => {
{currentTab === 0 && (
<div>
<Typography variant="h6">
<PortfolioDetails/>
<PortfolioDetails searchId={searchId}/>
</Typography>
</div>
)}
Expand Down
5 changes: 0 additions & 5 deletions frontend/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -6184,11 +6184,6 @@ fs.realpath@^1.0.0:
resolved "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz"
integrity sha512-OO0pH2lK6a0hZnAdau5ItzHPI6pUlvI7jMVnxUQRtw4owF2wk8lOSabtGDCTP4Ggrg2MbGnWO9X8K1t4+fGMDw==

fsevents@^2.3.2, fsevents@~2.3.2:
version "2.3.3"
resolved "https://registry.npmjs.org/fsevents/-/fsevents-2.3.3.tgz"
integrity sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw==

function-bind@^1.1.1, function-bind@^1.1.2:
version "1.1.2"
resolved "https://registry.npmjs.org/function-bind/-/function-bind-1.1.2.tgz"
Expand Down

0 comments on commit f85f924

Please sign in to comment.