Skip to content
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

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

itzamanjain
Copy link

@itzamanjain itzamanjain commented Oct 29, 2024

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.

  • Bullet points are helpful.
  • Screenshots are helpful (if applicable).
    Screenshot 2024-10-29 194228

Checklist ✅

  • I have added screenshots (if UI changes are present).
  • I have done a self-review of my code.
  • I have manually tested my code (if applicable).

@itzamanjain
Copy link
Author

looking for how to add native vs code notifcation

@cqdev-co
Copy link

@itzamanjain how's it going on this

@itzamanjain
Copy link
Author

itzamanjain commented Nov 10, 2024

@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);

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

Copy link
Author

@itzamanjain itzamanjain Nov 12, 2024

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

Comment on lines +42 to +44
useEffect(() => {
getMessage();
}, []);

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.

Copy link
Author

@itzamanjain itzamanjain Nov 12, 2024

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!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Warning for user is at 80% of quota for the month
3 participants