-
Notifications
You must be signed in to change notification settings - Fork 29
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
added credit usage warning on 80% #84
base: main
Are you sure you want to change the base?
added credit usage warning on 80% #84
Conversation
looking for how to add native vs code notifcation |
@itzamanjain how's it going on this |
@cqdev-co I added a VSCode native notification warning for it, along with our own custom notification, but I wasn't able to test the native notification. I also added logic to the server's /get-usage API, so it now returns a warningMessage if the credit is more than 80%, otherwise it returns WarningMessage : None. |
if (warning_message) { | ||
setMessage(warning_message); | ||
setIsVisible(true); | ||
vscode.window.showWarningMessage(warning_message); |
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.
does vscode.window work this way in react 👀 isnt working for me
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.
based on prev patterns used in code base i used this so we can native notification warning
useEffect(() => { | ||
getMessage(); | ||
}, []); |
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 will only fetch when component gets mounted, so if users is overusing credits it in a single go in one session, he wouldn't get notified right.
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.
Thinking of using setInterval to poll every 5 minutes for credit usage—open to better ideas if anyone has them!
Description ✏️
fix #18
What changed? Feel free to be brief.
Implemented functionality to fetch warning message from the server. (backend)
Display warning when usage exceeds 80%, helping users stay informed about their credit consumption.
Checklist ✅