Skip to content

feat(admin-ui): add create and edit organization screen #978

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

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

Conversation

rsbh
Copy link
Member

@rsbh rsbh commented Apr 29, 2025

No description provided.

Copy link

vercel bot commented Apr 29, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
frontier ✅ Ready (Inspect) Visit Preview 💬 Add feedback Apr 30, 2025 9:36am

@coveralls
Copy link

coveralls commented Apr 29, 2025

Pull Request Test Coverage Report for Build 14751453493

Warning: This coverage report may be inaccurate.

This pull request's base commit is no longer the HEAD commit of its target branch. This means it includes changes from outside the original pull request, including, potentially, unrelated coverage changes.

Details

  • 0 of 5 (0.0%) changed or added relevant lines in 1 file are covered.
  • 61 unchanged lines in 4 files lost coverage.
  • Overall coverage increased (+0.01%) to 33.339%

Changes Missing Coverage Covered Lines Changed/Added Lines %
pkg/server/server.go 0 5 0.0%
Files with Coverage Reduction New Missed Lines %
internal/api/v1beta1/v1beta1.go 2 0.0%
internal/store/postgres/user_repository.go 5 68.35%
pkg/server/interceptors/authorization.go 13 0.0%
cmd/serve.go 41 0.0%
Totals Coverage Status
Change from base Build 14706565379: 0.01%
Covered Lines: 9865
Relevant Lines: 29590

💛 - Coveralls

Copy link
Contributor

@Copilot 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 an edit organization screen to the admin UI. Key changes include:

  • Adding a new edit organization panel with its associated state management and routing.
  • Updating the organization context and API server configuration to support organization types.
  • Integrating the new edit organization functionality in the navigation and layout components.

Reviewed Changes

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

Show a summary per file
File Description
ui/src/utils/constants.ts Added optional organization_types to config and defaultConfig.
ui/src/pages/organizations/details/layout/navbar.tsx Added openEditOrgPanel prop and updated menu items for organization editing.
ui/src/pages/organizations/details/layout/index.tsx Introduced state and functions for opening/closing the edit organization panel.
ui/src/pages/organizations/details/index.tsx Added an updateOrganization function to update the organization state.
ui/src/pages/organizations/details/edit/organization.tsx Created the new edit organization panel with form handling and API integration.
ui/src/pages/organizations/details/edit/kyc.tsx Updated style import for the KYC panel.
ui/src/pages/organizations/details/contexts/organization-context.tsx Extended the organization context with an updateOrganization method.
pkg/server/server.go Updated API response to include token_product_id and organization_types.
pkg/server/config.go Added organization_types field to the server configuration.
Files not reviewed (1)
  • ui/src/pages/organizations/details/edit/edit.module.css: Language not supported
Comments suppressed due to low confidence (1)

ui/src/pages/organizations/details/layout/navbar.tsx:292

  • The component name 'OrganizationsDetailsNavabar' appears to contain a typo; consider renaming it to 'OrganizationsDetailsNavbar' for clarity.
export const OrganizationsDetailsNavabar = ({

@rsbh rsbh changed the title feat(admin-ui): add edit organization screen feat(admin-ui): add create and edit organization screen Apr 30, 2025
@rsbh rsbh requested a review from Copilot April 30, 2025 09:08
Copy link
Contributor

@Copilot 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 adds screens for creating and editing organizations within the admin UI. It also updates related navigation components, organization context, and server configuration to support the new organization types and additional organization data.

  • Added create and edit organization panels with form validation.
  • Updated navigation components to open the new panels.
  • Extended server configuration and API responses to include organization types and token product IDs.

Reviewed Changes

Copilot reviewed 13 out of 15 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
ui/src/utils/constants.ts Extended config interface and default config to support organization types.
ui/src/pages/organizations/list/navbar.tsx Added a new prop and onClick handler to launch the create organization panel.
ui/src/pages/organizations/list/index.tsx Introduced state management to conditionally render the create organization panel.
ui/src/pages/organizations/list/create.tsx New component for creating organizations with form fields and validation.
ui/src/pages/organizations/details/layout/navbar.tsx Updated the action menu to include an option for editing organization details.
ui/src/pages/organizations/details/layout/index.tsx Added state and functions to toggle the edit organization panel in the details layout.
ui/src/pages/organizations/details/index.tsx Provided an updateOrganization function via context for reflecting edits.
ui/src/pages/organizations/details/edit/organization.tsx New component for editing organization details with form validation.
ui/src/pages/organizations/details/edit/kyc.tsx Adjusted the imported style module for consistency with edit panels.
ui/src/pages/organizations/details/contexts/organization-context.tsx Added updateOrganization method to the organization context.
pkg/server/server.go & config.go Updated configuration to support the new organization type and token product ID.
Files not reviewed (2)
  • ui/src/pages/organizations/details/edit/edit.module.css: Language not supported
  • ui/src/pages/organizations/list/list.module.css: Language not supported
Comments suppressed due to low confidence (3)

ui/src/pages/organizations/list/navbar.tsx:21

  • The interface name 'OrganizationsNavabarProps' appears to have a typo; consider renaming it to 'OrganizationsNavbarProps' for clarity and consistency.
interface OrganizationsNavabarProps {

ui/src/pages/organizations/details/layout/navbar.tsx:292

  • The component name 'OrganizationsDetailsNavabar' seems to contain a typographical error; renaming it to 'OrganizationsDetailsNavbar' would improve readability.
export const OrganizationsDetailsNavabar = ({

ui/src/pages/organizations/details/edit/kyc.tsx:14

  • [nitpick] Please verify that the change from importing './kyc.module.css' to './edit.module.css' is intentional, ensuring that the styling remains consistent for the KYC panel.
import styles from "./edit.module.css";

Comment on lines 27 to 35
const orgUpdateSchema = z.object({
avatar: z.string().optional(),
title: z.string(),
name: z.string(),
size: z.string().transform((value) => parseInt(value)),
type: z.string(),
otherType: z.string(),
country: z.string(),
});
Copy link
Preview

Copilot AI Apr 30, 2025

Choose a reason for hiding this comment

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

[nitpick] Consider making the 'otherType' field optional in the schema if it is only applicable when the selected type is 'other', to avoid unnecessary validation errors.

Suggested change
const orgUpdateSchema = z.object({
avatar: z.string().optional(),
title: z.string(),
name: z.string(),
size: z.string().transform((value) => parseInt(value)),
type: z.string(),
otherType: z.string(),
country: z.string(),
});
const orgUpdateSchema = z
.object({
avatar: z.string().optional(),
title: z.string(),
name: z.string(),
size: z.string().transform((value) => parseInt(value)),
type: z.string(),
otherType: z.string().optional(),
country: z.string(),
})
.refine(
(data) => data.type !== "other" || (data.type === "other" && data.otherType),
{
message: "otherType is required when type is 'other'.",
path: ["otherType"],
},
);

Copilot uses AI. Check for mistakes.

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.

2 participants