-
Notifications
You must be signed in to change notification settings - Fork 40
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Telegram channel id on ethical metrics implementation #1890
Conversation
…/DNP_DAPPMANAGER into mateu/telegram-channel-id-input
DAppNode bot has built and pinned the release to an IPFS node, for commit: 291bb63 This is a development version and should only be installed for testing purposes, install link
(by dappnodebot/build-action) |
try { | ||
setValidationMessage("Enabling ethical metrics..."); | ||
await api.enableEthicalMetrics({ | ||
mail: mailValue || mail, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is weird, use just one value
setValidationMessage("Enabling ethical metrics..."); | ||
await api.enableEthicalMetrics({ | ||
mail: mailValue || mail, | ||
tgChannelId: tgChannelIdValue || tgChannelId, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same as above
|
||
async function enableEthicalMetricsSync({ | ||
mailValue, | ||
tgChannelIdValue |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
consider using the useState
s instead of function arguments
await api.enableEthicalMetrics({ | ||
mail: mailValue || mail, | ||
tgChannelId: tgChannelIdValue || tgChannelId, | ||
sync: true |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Have you test the behaviour of setting this with option sync
to true? Take into account that this might be the onboarding and might take some time the user would not like to wait during setting up dappnode
}) | ||
} | ||
variant="dappnode" | ||
disabled={ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
could you try to simplify this condition?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it looks a bit complex
) : ( | ||
<SwitchBig | ||
disabled={ | ||
(tgChannelId === "" && mail === "") || |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same as above
packages/admin-ui/src/pages/system/components/Notifications/EthicalMetrics.tsx
Show resolved
Hide resolved
} catch (e) { | ||
setReqStatusDisable({ error: e }); | ||
console.error("Error on registerEthicalMetrics", e); | ||
} | ||
} | ||
|
||
function enableEthicalSwitch() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I dont get this, its useless to have a function that just calls another function. Remove it if possible
Update | ||
</Button> | ||
) : ( | ||
<></> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Dont add an empty element, instead use above the operator ethicalMetricsOn && ( )
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
TypeScript can have issues inferring the correct type. Using undefined instead of an empty fragment is often clearer in terms of intent maybe?
packages/admin-ui/src/pages/system/components/Notifications/EthicalMetrics.tsx
Show resolved
Hide resolved
…e button disabling. Implemented 5s validation display.
…ified Ethical metrics changes
Ethical metrics enhancement modal
Inputs for the telegram id added in the system / notifications section, and also in the onboarding modal of ethical metrics.
Welcome Modal:
System > Notifications:
These changes aim to empower users with more control over their notifications while maintaining privacy and enhancing the overall user experience.