mirror of
https://github.com/hex248/sprint.git
synced 2026-02-08 10:33:01 +00:00
super basic account page with link on Index page
This commit is contained in:
15
packages/frontend/src/Account.tsx
Normal file
15
packages/frontend/src/Account.tsx
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
import LogOutButton from "@/components/log-out-button";
|
||||||
|
|
||||||
|
function Account() {
|
||||||
|
return (
|
||||||
|
<main className="w-full h-[100vh] flex flex-col items-center justify-center gap-4 p-4">
|
||||||
|
<h1 className="text-3xl font-bold">Account</h1>
|
||||||
|
|
||||||
|
<p className="text-muted-foreground">Account page here</p>
|
||||||
|
|
||||||
|
<LogOutButton />
|
||||||
|
</main>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
export default Account;
|
||||||
@@ -2,6 +2,7 @@ import { BrowserRouter, Route, Routes } from "react-router-dom";
|
|||||||
import { Auth } from "@/components/auth-provider";
|
import { Auth } from "@/components/auth-provider";
|
||||||
import { ThemeProvider } from "@/components/theme-provider";
|
import { ThemeProvider } from "@/components/theme-provider";
|
||||||
import Index from "@/Index";
|
import Index from "@/Index";
|
||||||
|
import Account from "@/Account";
|
||||||
import Test from "@/Test";
|
import Test from "@/Test";
|
||||||
|
|
||||||
function App() {
|
function App() {
|
||||||
@@ -11,6 +12,7 @@ function App() {
|
|||||||
<BrowserRouter>
|
<BrowserRouter>
|
||||||
<Routes>
|
<Routes>
|
||||||
<Route path="/" element={<Index />} />
|
<Route path="/" element={<Index />} />
|
||||||
|
<Route path="/account" element={<Account />} />
|
||||||
<Route path="/test" element={<Test />} />
|
<Route path="/test" element={<Test />} />
|
||||||
</Routes>
|
</Routes>
|
||||||
</BrowserRouter>
|
</BrowserRouter>
|
||||||
|
|||||||
@@ -1,11 +1,17 @@
|
|||||||
import type { IssueResponse, OrganisationResponse, ProjectResponse, UserRecord } from "@issue/shared";
|
import type { IssueResponse, OrganisationResponse, ProjectResponse, UserRecord } from "@issue/shared";
|
||||||
import { useEffect, useRef, useState } from "react";
|
import { useEffect, useRef, useState } from "react";
|
||||||
|
import { Link } from "react-router-dom";
|
||||||
import { IssueDetailPane } from "@/components/issue-detail-pane";
|
import { IssueDetailPane } from "@/components/issue-detail-pane";
|
||||||
import { IssuesTable } from "@/components/issues-table";
|
import { IssuesTable } from "@/components/issues-table";
|
||||||
import SmallUserDisplay from "@/components/small-user-display";
|
import SmallUserDisplay from "@/components/small-user-display";
|
||||||
|
import {
|
||||||
|
DropdownMenu,
|
||||||
|
DropdownMenuContent,
|
||||||
|
DropdownMenuItem,
|
||||||
|
DropdownMenuTrigger,
|
||||||
|
} from "@/components/ui/dropdown-menu";
|
||||||
import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from "@/components/ui/select";
|
import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from "@/components/ui/select";
|
||||||
import { getAuthHeaders } from "@/lib/utils";
|
import { getAuthHeaders } from "@/lib/utils";
|
||||||
import LogOutButton from "./components/log-out-button";
|
|
||||||
|
|
||||||
function Index() {
|
function Index() {
|
||||||
const serverURL = import.meta.env.VITE_SERVER_URL?.trim() || "http://localhost:3000";
|
const serverURL = import.meta.env.VITE_SERVER_URL?.trim() || "http://localhost:3000";
|
||||||
@@ -109,7 +115,7 @@ function Index() {
|
|||||||
}}
|
}}
|
||||||
onOpenChange={setOrganisationSelectOpen}
|
onOpenChange={setOrganisationSelectOpen}
|
||||||
>
|
>
|
||||||
<SelectTrigger className="h-8 lg:flex" isOpen={organisationSelectOpen}>
|
<SelectTrigger className="text-sm" isOpen={organisationSelectOpen}>
|
||||||
<SelectValue
|
<SelectValue
|
||||||
placeholder={
|
placeholder={
|
||||||
selectedOrganisation
|
selectedOrganisation
|
||||||
@@ -152,7 +158,7 @@ function Index() {
|
|||||||
}}
|
}}
|
||||||
onOpenChange={setProjectSelectOpen}
|
onOpenChange={setProjectSelectOpen}
|
||||||
>
|
>
|
||||||
<SelectTrigger className="h-8 lg:flex" isOpen={projectSelectOpen}>
|
<SelectTrigger className="text-sm" isOpen={projectSelectOpen}>
|
||||||
<SelectValue
|
<SelectValue
|
||||||
placeholder={
|
placeholder={
|
||||||
selectedProject
|
selectedProject
|
||||||
@@ -161,7 +167,7 @@ function Index() {
|
|||||||
}
|
}
|
||||||
/>
|
/>
|
||||||
</SelectTrigger>
|
</SelectTrigger>
|
||||||
<SelectContent side="bottom" position="popper">
|
<SelectContent side="bottom" position="popper" align={"start"}>
|
||||||
{projects.map((project) => (
|
{projects.map((project) => (
|
||||||
<SelectItem key={project.Project.id} value={`${project.Project.id}`}>
|
<SelectItem key={project.Project.id} value={`${project.Project.id}`}>
|
||||||
{project.Project.name}
|
{project.Project.name}
|
||||||
@@ -173,12 +179,28 @@ function Index() {
|
|||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{user && (
|
<div className="flex gap-2 items-center">
|
||||||
<div className="flex items-center gap-2">
|
<DropdownMenu>
|
||||||
You:
|
<DropdownMenuTrigger className="text-sm">
|
||||||
<SmallUserDisplay user={user} />
|
<SmallUserDisplay user={user} />
|
||||||
</div>
|
</DropdownMenuTrigger>
|
||||||
)}
|
<DropdownMenuContent align={"end"}>
|
||||||
|
<DropdownMenuItem asChild className="flex items-end justify-end">
|
||||||
|
<Link to="/account" className="p-0 text-end">Settings</Link>
|
||||||
|
</DropdownMenuItem>
|
||||||
|
</DropdownMenuContent>
|
||||||
|
</DropdownMenu>
|
||||||
|
{/*<SmallUserDisplay user={user} />*/}
|
||||||
|
|
||||||
|
{/* <Button onClick={() => {
|
||||||
|
window.location.href = "/account";
|
||||||
|
}}
|
||||||
|
variant={"dummy"}
|
||||||
|
className={"border rounded-full p-0 size-9 text-md"}
|
||||||
|
>
|
||||||
|
<Settings className="" />
|
||||||
|
</Button> */}
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
{/* main body */}
|
{/* main body */}
|
||||||
<div className="w-full h-full flex items-start justify-between pt-1 gap-2">
|
<div className="w-full h-full flex items-start justify-between pt-1 gap-2">
|
||||||
@@ -206,7 +228,7 @@ function Index() {
|
|||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<LogOutButton />
|
{/* <LogOutButton /> */}
|
||||||
</main>
|
</main>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ import Avatar from "@/components/avatar";
|
|||||||
export default function SmallUserDisplay({ user }: { user: UserRecord }) {
|
export default function SmallUserDisplay({ user }: { user: UserRecord }) {
|
||||||
return (
|
return (
|
||||||
<div className="flex gap-2 items-center">
|
<div className="flex gap-2 items-center">
|
||||||
{user.name} <Avatar user={user} />
|
{user.name} <Avatar user={user} size={6} />
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user