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

Add revamp user and login page #137

Merged
merged 14 commits into from
Sep 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions backend/enmedd/server/manage/users.py
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,12 @@ def list_all_users(
status=UserStatus.LIVE
if user.is_active
else UserStatus.DEACTIVATED,
full_name=user.full_name,
billing_email_address=user.billing_email_address,
company_billing=user.company_billing,
company_email=user.company_email,
company_name=user.company_name,
vat=user.vat,
)
for user in users
],
Expand All @@ -138,6 +144,12 @@ def list_all_users(
email=user.email,
role=user.role,
status=UserStatus.LIVE if user.is_active else UserStatus.DEACTIVATED,
full_name=user.full_name,
billing_email_address=user.billing_email_address,
company_billing=user.company_billing,
company_email=user.company_email,
company_name=user.company_name,
vat=user.vat,
)
for user in users
][accepted_page * USERS_PAGE_SIZE : (accepted_page + 1) * USERS_PAGE_SIZE],
Expand Down
7 changes: 7 additions & 0 deletions backend/enmedd/server/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
from uuid import UUID

from pydantic import BaseModel
from pydantic import EmailStr
from pydantic.generics import GenericModel

from enmedd.auth.schemas import UserRole
Expand Down Expand Up @@ -34,6 +35,12 @@ class MinimalUserSnapshot(BaseModel):

class FullUserSnapshot(BaseModel):
id: UUID
full_name: str
company_name: Optional[str]
company_email: Optional[EmailStr]
company_billing: Optional[str]
billing_email_address: Optional[EmailStr]
vat: Optional[str]
email: str
role: UserRole
status: UserStatus
Expand Down
36 changes: 36 additions & 0 deletions web/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions web/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
"@radix-ui/react-dropdown-menu": "^2.1.1",
"@radix-ui/react-label": "^2.1.0",
"@radix-ui/react-popover": "^1.1.1",
"@radix-ui/react-progress": "^1.1.0",
"@radix-ui/react-radio-group": "^1.2.0",
"@radix-ui/react-select": "^2.1.1",
"@radix-ui/react-separator": "^1.1.0",
Expand All @@ -42,6 +43,7 @@
"date-fns": "^3.6.0",
"formik": "^2.2.9",
"framer-motion": "^11.3.24",
"input-otp": "^1.2.4",
"js-cookie": "^3.0.5",
"lenis": "^1.0.45",
"lodash": "^4.17.21",
Expand Down
Binary file added web/public/LoginImage.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added web/public/default-user-chart.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
7 changes: 7 additions & 0 deletions web/public/microsoft.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
51 changes: 51 additions & 0 deletions web/src/app/admin/users/AddUserButton.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
"use client";

import BulkAdd from "@/components/admin/users/BulkAdd";
import { CustomModal } from "@/components/CustomModal";
import { Button } from "@/components/ui/button";
import { Label } from "@/components/ui/label";
import { useToast } from "@/hooks/use-toast";
import { useState } from "react";
import { mutate } from "swr";

export const AddUserButton = () => {
const [isModalOpen, setIsModalOpen] = useState(false);
const { toast } = useToast();
const onSuccess = () => {
mutate(
(key) => typeof key === "string" && key.startsWith("/api/manage/users")
);
setIsModalOpen(false);
toast({
title: "Success",
description: "Users invited!",
variant: "success",
});
};
const onFailure = async (res: Response) => {
const error = (await res.json()).detail;
toast({
title: "Error",
description: `Failed to invite users - ${error}`,
variant: "destructive",
});
};

return (
<CustomModal
title="Bulk Add Users"
onClose={() => setIsModalOpen(false)}
open={isModalOpen}
trigger={
<Button onClick={() => setIsModalOpen(true)}>Invite People</Button>
}
>
<div className="flex flex-col gap-y-3 pt-4">
<Label>
Add the email addresses to import, separated by whitespaces.
</Label>
<BulkAdd onSuccess={onSuccess} onFailure={onFailure} />
</div>
</CustomModal>
);
};
Loading
Loading