Skip to content

Develop#50

Merged
ma-mirzaei merged 4 commits intovitruv-tools:developfrom
TsotneMikadze:develop
Sep 25, 2025
Merged

Develop#50
ma-mirzaei merged 4 commits intovitruv-tools:developfrom
TsotneMikadze:develop

Conversation

@TsotneMikadze
Copy link
Contributor

@TsotneMikadze TsotneMikadze commented Sep 23, 2025

summery of your works
@TsotneMikadze

@ma-mirzaei
Copy link
Contributor

@TsotneMikadze
please link the pull request to relate issues
Also write the good description for your PR

@ma-mirzaei ma-mirzaei requested a review from Copilot September 25, 2025 07:15
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR introduces comprehensive user experience improvements including a new toast notification system, enhanced modals for creating vSUMs, better error handling in auth services, and additional API functionality for user management.

  • Adds a global toast notification system with success, error, and info message types
  • Replaces inline vSUM creation form with a dedicated modal interface
  • Improves authentication flow to fetch authoritative user data from the API
  • Simplifies error message formatting in authentication services

Reviewed Changes

Copilot reviewed 10 out of 10 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
src/services/auth.ts Simplified error message formatting by removing status codes
src/services/api.ts Added getUserInfo endpoint and enhanced createVsum to accept description
src/index.tsx Wrapped app with ToastProvider for global notifications
src/contexts/AuthContext.tsx Enhanced user data fetching to prefer API over JWT parsing
src/components/ui/VsumsPanel.tsx Replaced inline form with modal-based vSUM creation
src/components/ui/ToastProvider.tsx New toast notification system implementation
src/components/ui/MetaModelsPanel.tsx Added delete functionality for meta models
src/components/ui/CreateVsumModal.tsx New modal component for vSUM creation
src/components/ui/CreateModelModal.tsx Moved progress indicator to bottom of modal
src/components/index.ts Exported new ToastProvider components

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

Comment on lines +71 to +72
const fallback = response.statusText || 'Request failed';
throw new Error(errorMessage || fallback);
Copy link

Copilot AI Sep 25, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The simplified error handling removes valuable debugging information. HTTP status codes help developers and users understand the nature of the failure (e.g., 401 Unauthorized vs 500 Server Error). Consider preserving the status code while simplifying the format, such as throw new Error(errorMessage ? ${response.status}: ${errorMessage}:${response.status} ${fallback}`);

Copilot uses AI. Check for mistakes.
AuthService.setCurrentUser(mapped);
setUser(mapped);
} catch (e) {
// Fallback: try to parse from token if API not available
Copy link

Copilot AI Sep 25, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[nitpick] The comment should be 'Fallback: Try to parse from token if API is not available' or 'Fallback: try to parse from token if API call fails' for better clarity and grammar.

Suggested change
// Fallback: try to parse from token if API not available
// Fallback: Try to parse from token if API is not available

Copilot uses AI. Check for mistakes.
setUser(mapped);
return;
} catch (e) {
// Fallback: parse JWT
Copy link

Copilot AI Sep 25, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This comment is too brief and doesn't explain why JWT parsing is a fallback. Consider expanding to 'Fallback: parse JWT token if API call fails to get user info' for better code documentation.

Suggested change
// Fallback: parse JWT
// Fallback: parse JWT token if API call fails to get user info

Copilot uses AI. Check for mistakes.
try {
const res = await apiService.createVsum({ name: trimmedName, description: description.trim() || undefined });
onSuccess?.(res.data);
showSuccess('Vsum successfully created');
Copy link

Copilot AI Sep 25, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The success message should be 'vSUM successfully created' to match the consistent capitalization used throughout the codebase (as seen in the modal title and other references).

Suggested change
showSuccess('Vsum successfully created');
showSuccess('vSUM successfully created');

Copilot uses AI. Check for mistakes.
@ma-mirzaei ma-mirzaei linked an issue Sep 25, 2025 that may be closed by this pull request
@ma-mirzaei ma-mirzaei self-requested a review September 25, 2025 08:18
@ma-mirzaei ma-mirzaei merged commit ed321fb into vitruv-tools:develop Sep 25, 2025
1 of 2 checks passed
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.

Using correct api to fetch user information

3 participants