Skip to content

Commit

Permalink
cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
Megha-Dev-19 committed Jan 2, 2025
1 parent 4dc4688 commit fb9762c
Show file tree
Hide file tree
Showing 19 changed files with 83 additions and 255 deletions.
4 changes: 0 additions & 4 deletions instances/treasury-devdao.near/widget/components/DropDown.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,6 @@ const StyledDropdown = styled.div`
right: 5%;
}
.cursor-pointer {
cursor: pointer;
}
.text-sm {
font-size: 12px !important;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,10 +98,6 @@ const Container = styled.div`
background-color: var(--grey-04);
}
.cursor-pointer {
cursor: pointer;
}
.text-wrap {
overflow: hidden;
white-space: normal;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -107,14 +107,6 @@ const Container = styled.div`
.custom-select {
position: relative;
}
.cursor-pointer {
cursor: pointer;
}
.text-sm {
font-size: 13px;
}
`;

const Item = ({ option }) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -163,10 +163,6 @@ const Container = styled.div`
background-color: var(--grey-04);
}
.cursor-pointer {
cursor: pointer;
}
.text-wrap {
overflow: hidden;
white-space: normal;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,10 +74,6 @@ const Container = styled.div`
background-color: var(--grey-04);
}
.cursor-pointer {
cursor: pointer;
}
.text-wrap {
overflow: hidden;
white-space: normal;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -350,6 +350,10 @@ function AppLayout({ page, instance, children, treasuryDaoID }) {
.border-right {
border-right: 1px solid var(--border-color);
}
.cursor-pointer {
cursor: pointer;
}
`;

return (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -226,10 +226,6 @@ const Container = styled.div`
}
}
.cursor-pointer {
cursor: pointer;
}
table {
overflow-x: auto;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -208,9 +208,6 @@ const Container = styled.div`
color: black !important;
}
.text-sm {
font-size: 13px;
}
.warning {
background-color: rgba(255, 158, 0, 0.1);
color: #ff9e00;
Expand Down
14 changes: 2 additions & 12 deletions instances/treasury-devdao.near/widget/pages/payments/Table.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -70,16 +70,6 @@ const Container = styled.div`
}
`;

const ToastContainer = styled.div`
a {
color: black !important;
text-decoration: underline !important;
&:hover {
color: black !important;
}
}
`;

function checkProposalStatus(proposalId) {
Near.asyncView(treasuryDaoID, "get_proposal", {
id: proposalId,
Expand Down Expand Up @@ -210,15 +200,15 @@ const VoteSuccessToast = () => {
return showToastStatus &&
(typeof voteProposalId === "number" ||
typeof highlightProposalId === "number") ? (
<ToastContainer className="toast-container position-fixed bottom-0 end-0 p-3">
<div className="toast-container position-fixed bottom-0 end-0 p-3">
<div className={`toast ${showToastStatus ? "show" : ""}`}>
<div className="toast-header px-2">
<strong className="me-auto">Just Now</strong>
<i className="bi bi-x-lg h6" onClick={() => setToastStatus(null)}></i>
</div>
<ToastStatusContent />
</div>
</ToastContainer>
</div>
) : null;
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,16 +56,6 @@ const Container = styled.div`
}
`;

const ToastContainer = styled.div`
a {
color: black !important;
text-decoration: underline !important;
&:hover {
color: black !important;
}
}
`;

function checkProposalStatus(proposalId) {
Near.asyncView(treasuryDaoID, "get_proposal", {
id: proposalId,
Expand Down Expand Up @@ -180,15 +170,15 @@ const VoteSuccessToast = () => {
return showToastStatus &&
(typeof voteProposalId === "number" ||
typeof highlightProposalId === "number") ? (
<ToastContainer className="toast-container position-fixed bottom-0 end-0 p-3">
<div className="toast-container position-fixed bottom-0 end-0 p-3">
<div className={`toast ${showToastStatus ? "show" : ""}`}>
<div className="toast-header px-2">
<strong className="me-auto">Just Now</strong>
<i className="bi bi-x-lg h6" onClick={() => setToastStatus(null)}></i>
</div>
<ToastStatusContent />
</div>
</ToastContainer>
</div>
) : null;
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -113,20 +113,10 @@ useEffect(() => {
}
}, [currentPage, rowsPerPage, allMembers]);

const ToastContainer = styled.div`
a {
color: black !important;
text-decoration: underline !important;
&:hover {
color: black !important;
}
}
`;

const SubmitToast = () => {
return (
showToastStatus && (
<ToastContainer className="toast-container position-fixed bottom-0 end-0 p-3">
<div className="toast-container position-fixed bottom-0 end-0 p-3">
<div className={`toast ${showToastStatus ? "show" : ""}`}>
<div className="toast-header px-2">
<strong className="me-auto">Just Now</strong>
Expand All @@ -149,7 +139,7 @@ const SubmitToast = () => {
</a>
</div>
</div>
</ToastContainer>
</div>
)
);
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,18 +79,10 @@ const Container = styled.div`
background-color: var(--grey-04);
}
.cursor-pointer {
cursor: pointer;
}
.text-wrap {
overflow: hidden;
white-space: normal;
}
.text-sm {
font-size: 13px;
}
`;

const handleOptionClick = (option) => {
Expand Down
107 changes: 63 additions & 44 deletions instances/treasury-devdao.near/widget/pages/settings/Theme.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,59 +27,19 @@ const [image, setImage] = useState(defaultImage);
const [color, setColor] = useState(defaultColor);
const [selectedTheme, setSelectedTheme] = useState(ThemeOptions[0]);
const [error, setError] = useState(null);
const [isTxnCreated, setTxnCreated] = useState(false);
const [showToastStatus, setToastStatus] = useState(false);
const [lastProposalId, setLastProposalId] = useState(null);

const Container = styled.div`
max-width: 50rem;
font-size: 14px;
.card-title {
font-size: 18px;
font-weight: 600;
padding-block: 5px;
border-bottom: 1px solid var(--border-color);
}
.selected-role {
background-color: var(--grey-04);
}
.cursor-pointer {
cursor: pointer;
}
.tag {
background-color: var(--grey-04);
font-size: 12px;
padding-block: 5px;
}
label {
color: rgba(153, 153, 153, 1);
color: var(--text-secondary);
font-size: 12px;
}
.fw-bold {
font-weight: 500 !important;
}
.p-0 {
padding: 0 !important;
}
.text-md {
font-size: 13px;
}
.warning {
background-color: rgba(255, 158, 0, 0.1);
color: var(--other-warning);
font-weight: 500;
}
.text-sm {
font-size: 12px !important;
}
.error-message {
color: #d95c4a;
background-color: rgba(217, 92, 74, 0.08);
Expand Down Expand Up @@ -222,11 +182,69 @@ const code = `
</html>
`;

const SubmitToast = () => {
return (
showToastStatus && (
<div className="toast-container position-fixed bottom-0 end-0 p-3">
<div className={`toast ${showToastStatus ? "show" : ""}`}>
<div className="toast-header px-2">
<strong className="me-auto">Just Now</strong>
<i
className="bi bi-x-lg h6"
onClick={() => setToastStatus(null)}
></i>
</div>
<div className="toast-body">
<div>Theme change request submitted.</div>
<a
href={href({
widgetSrc: `${instance}/widget/app`,
params: {
page: "settings",
},
})}
>
View it
</a>
</div>
</div>
</div>
)
);
};

function getLastProposalId() {
return Near.asyncView(treasuryDaoID, "get_last_proposal_id").then(
(result) => result
);
}

useEffect(() => {
getLastProposalId().then((i) => setLastProposalId(i));
}, []);

useEffect(() => {
if (isTxnCreated) {
const checkForNewProposal = () => {
getLastProposalId().then((id) => {
if (lastProposalId !== id) {
setToastStatus(true);
setTxnCreated(false);
} else {
setTimeout(() => checkForNewProposal(), 1000);
}
});
};
checkForNewProposal();
}
}, [isTxnCreated]);

function toBase64(json) {
return Buffer.from(JSON.stringify(json)).toString("base64");
}

function onSubmitClick() {
setTxnCreated(true);
const deposit = daoPolicy?.proposal_bond || 100000000000000000000000;

const description = {
Expand Down Expand Up @@ -276,6 +294,7 @@ useEffect(() => {

return (
<Container>
<SubmitToast />
<div className="card rounded-3 w-100 h-100 p-3">
{!metadata ? (
<div
Expand Down
Loading

0 comments on commit fb9762c

Please sign in to comment.