mirror of
https://github.com/hex248/sprint.git
synced 2026-02-07 18:23:03 +00:00
removed Dialog from component names and changed -modal to -form
This commit is contained in:
@@ -15,7 +15,7 @@ import { parseError } from "@/lib/server";
|
|||||||
import { cn } from "@/lib/utils";
|
import { cn } from "@/lib/utils";
|
||||||
import ThemeToggle from "./theme-toggle";
|
import ThemeToggle from "./theme-toggle";
|
||||||
|
|
||||||
function AccountDialog({ trigger }: { trigger?: ReactNode }) {
|
function Account({ trigger }: { trigger?: ReactNode }) {
|
||||||
const { user: currentUser, setUser } = useAuthenticatedSession();
|
const { user: currentUser, setUser } = useAuthenticatedSession();
|
||||||
const updateUser = useUpdateUser();
|
const updateUser = useUpdateUser();
|
||||||
|
|
||||||
@@ -175,4 +175,4 @@ function AccountDialog({ trigger }: { trigger?: ReactNode }) {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
export default AccountDialog;
|
export default Account;
|
||||||
@@ -14,7 +14,7 @@ import { Field } from "@/components/ui/field";
|
|||||||
import { useAddOrganisationMember } from "@/lib/query/hooks";
|
import { useAddOrganisationMember } from "@/lib/query/hooks";
|
||||||
import { parseError, user } from "@/lib/server";
|
import { parseError, user } from "@/lib/server";
|
||||||
|
|
||||||
export function AddMemberDialog({
|
export function AddMember({
|
||||||
organisationId,
|
organisationId,
|
||||||
existingMembers,
|
existingMembers,
|
||||||
trigger,
|
trigger,
|
||||||
@@ -29,7 +29,7 @@ import {
|
|||||||
import { parseError } from "@/lib/server";
|
import { parseError } from "@/lib/server";
|
||||||
import { cn, issueID } from "@/lib/utils";
|
import { cn, issueID } from "@/lib/utils";
|
||||||
|
|
||||||
export function IssueModal({ trigger }: { trigger?: React.ReactNode }) {
|
export function IssueForm({ trigger }: { trigger?: React.ReactNode }) {
|
||||||
const { user } = useAuthenticatedSession();
|
const { user } = useAuthenticatedSession();
|
||||||
const selectedOrganisation = useSelectedOrganisation();
|
const selectedOrganisation = useSelectedOrganisation();
|
||||||
const selectedProject = useSelectedProject();
|
const selectedProject = useSelectedProject();
|
||||||
@@ -4,7 +4,7 @@ import { USER_NAME_MAX_LENGTH, USER_USERNAME_MAX_LENGTH } from "@sprint/shared";
|
|||||||
import { useEffect, useState } from "react";
|
import { useEffect, useState } from "react";
|
||||||
import { useNavigate, useSearchParams } from "react-router-dom";
|
import { useNavigate, useSearchParams } from "react-router-dom";
|
||||||
import Avatar from "@/components/avatar";
|
import Avatar from "@/components/avatar";
|
||||||
import { ServerConfigurationDialog } from "@/components/server-configuration-dialog";
|
import { ServerConfiguration } from "@/components/server-configuration";
|
||||||
import { useSession } from "@/components/session-provider";
|
import { useSession } from "@/components/session-provider";
|
||||||
import { Button } from "@/components/ui/button";
|
import { Button } from "@/components/ui/button";
|
||||||
import { Dialog, DialogContent, DialogTitle, DialogTrigger } from "@/components/ui/dialog";
|
import { Dialog, DialogContent, DialogTitle, DialogTrigger } from "@/components/ui/dialog";
|
||||||
@@ -219,7 +219,7 @@ export default function LogInForm() {
|
|||||||
error !== "" && "border-destructive",
|
error !== "" && "border-destructive",
|
||||||
)}
|
)}
|
||||||
>
|
>
|
||||||
<ServerConfigurationDialog />
|
<ServerConfiguration />
|
||||||
<span className="text-xl font-basteleur mb-2">{capitalise(mode)}</span>
|
<span className="text-xl font-basteleur mb-2">{capitalise(mode)}</span>
|
||||||
|
|
||||||
<div className={"flex flex-col items-center mb-0"}>
|
<div className={"flex flex-col items-center mb-0"}>
|
||||||
|
|||||||
@@ -30,7 +30,7 @@ const slugify = (value: string) =>
|
|||||||
.replace(/^-+/, "")
|
.replace(/^-+/, "")
|
||||||
.replace(/-{2,}/g, "-");
|
.replace(/-{2,}/g, "-");
|
||||||
|
|
||||||
export function OrganisationModal({
|
export function OrganisationForm({
|
||||||
trigger,
|
trigger,
|
||||||
completeAction,
|
completeAction,
|
||||||
errorAction,
|
errorAction,
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
import { useEffect, useMemo, useState } from "react";
|
import { useEffect, useMemo, useState } from "react";
|
||||||
import { toast } from "sonner";
|
import { toast } from "sonner";
|
||||||
import { OrganisationModal } from "@/components/organisation-modal";
|
import { OrganisationForm } from "@/components/organisation-form";
|
||||||
import { useSelection } from "@/components/selection-provider";
|
import { useSelection } from "@/components/selection-provider";
|
||||||
import { Button } from "@/components/ui/button";
|
import { Button } from "@/components/ui/button";
|
||||||
import {
|
import {
|
||||||
@@ -102,7 +102,7 @@ export function OrganisationSelect({
|
|||||||
{organisations.length > 0 && <SelectSeparator />}
|
{organisations.length > 0 && <SelectSeparator />}
|
||||||
</SelectGroup>
|
</SelectGroup>
|
||||||
|
|
||||||
<OrganisationModal
|
<OrganisationForm
|
||||||
trigger={
|
trigger={
|
||||||
<Button variant="ghost" className={"w-full"} size={"sm"}>
|
<Button variant="ghost" className={"w-full"} size={"sm"}>
|
||||||
Create Organisation
|
Create Organisation
|
||||||
|
|||||||
@@ -2,16 +2,16 @@ import { DEFAULT_STATUS_COLOUR, ISSUE_STATUS_MAX_LENGTH, type SprintRecord } fro
|
|||||||
import { useQueryClient } from "@tanstack/react-query";
|
import { useQueryClient } from "@tanstack/react-query";
|
||||||
import { type ReactNode, useCallback, useEffect, useMemo, useState } from "react";
|
import { type ReactNode, useCallback, useEffect, useMemo, useState } from "react";
|
||||||
import { toast } from "sonner";
|
import { toast } from "sonner";
|
||||||
import { AddMemberDialog } from "@/components/add-member-dialog";
|
import { AddMember } from "@/components/add-member";
|
||||||
import { OrganisationModal } from "@/components/organisation-modal";
|
import { OrganisationForm } from "@/components/organisation-form";
|
||||||
import { OrganisationSelect } from "@/components/organisation-select";
|
import { OrganisationSelect } from "@/components/organisation-select";
|
||||||
import { ProjectModal } from "@/components/project-modal";
|
import { ProjectForm } from "@/components/project-form";
|
||||||
import { ProjectSelect } from "@/components/project-select";
|
import { ProjectSelect } from "@/components/project-select";
|
||||||
import { useSelection } from "@/components/selection-provider";
|
import { useSelection } from "@/components/selection-provider";
|
||||||
import { useAuthenticatedSession } from "@/components/session-provider";
|
import { useAuthenticatedSession } from "@/components/session-provider";
|
||||||
import SmallSprintDisplay from "@/components/small-sprint-display";
|
import SmallSprintDisplay from "@/components/small-sprint-display";
|
||||||
import SmallUserDisplay from "@/components/small-user-display";
|
import SmallUserDisplay from "@/components/small-user-display";
|
||||||
import { SprintModal } from "@/components/sprint-modal";
|
import { SprintForm } from "@/components/sprint-form";
|
||||||
import StatusTag from "@/components/status-tag";
|
import StatusTag from "@/components/status-tag";
|
||||||
import { Button } from "@/components/ui/button";
|
import { Button } from "@/components/ui/button";
|
||||||
import ColourPicker from "@/components/ui/colour-picker";
|
import ColourPicker from "@/components/ui/colour-picker";
|
||||||
@@ -45,7 +45,7 @@ import { queryKeys } from "@/lib/query/keys";
|
|||||||
import { issue } from "@/lib/server";
|
import { issue } from "@/lib/server";
|
||||||
import { capitalise } from "@/lib/utils";
|
import { capitalise } from "@/lib/utils";
|
||||||
|
|
||||||
function OrganisationsDialog({ trigger }: { trigger?: ReactNode }) {
|
function Organisations({ trigger }: { trigger?: ReactNode }) {
|
||||||
const { user } = useAuthenticatedSession();
|
const { user } = useAuthenticatedSession();
|
||||||
const queryClient = useQueryClient();
|
const queryClient = useQueryClient();
|
||||||
const { selectedOrganisationId, selectedProjectId } = useSelection();
|
const { selectedOrganisationId, selectedProjectId } = useSelection();
|
||||||
@@ -540,7 +540,7 @@ function OrganisationsDialog({ trigger }: { trigger?: ReactNode }) {
|
|||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<OrganisationModal
|
<OrganisationForm
|
||||||
mode="edit"
|
mode="edit"
|
||||||
existingOrganisation={selectedOrganisation.Organisation}
|
existingOrganisation={selectedOrganisation.Organisation}
|
||||||
open={editOrgOpen}
|
open={editOrgOpen}
|
||||||
@@ -621,7 +621,7 @@ function OrganisationsDialog({ trigger }: { trigger?: ReactNode }) {
|
|||||||
))}
|
))}
|
||||||
</div>
|
</div>
|
||||||
{isAdmin && (
|
{isAdmin && (
|
||||||
<AddMemberDialog
|
<AddMember
|
||||||
organisationId={selectedOrganisation.Organisation.id}
|
organisationId={selectedOrganisation.Organisation.id}
|
||||||
existingMembers={members.map((m) => m.User.username)}
|
existingMembers={members.map((m) => m.User.username)}
|
||||||
onSuccess={(user) => {
|
onSuccess={(user) => {
|
||||||
@@ -827,7 +827,7 @@ function OrganisationsDialog({ trigger }: { trigger?: ReactNode }) {
|
|||||||
);
|
);
|
||||||
})}
|
})}
|
||||||
{isAdmin && (
|
{isAdmin && (
|
||||||
<SprintModal
|
<SprintForm
|
||||||
projectId={selectedProject?.Project.id}
|
projectId={selectedProject?.Project.id}
|
||||||
trigger={
|
trigger={
|
||||||
<Button variant="outline" size="sm">
|
<Button variant="outline" size="sm">
|
||||||
@@ -854,7 +854,7 @@ function OrganisationsDialog({ trigger }: { trigger?: ReactNode }) {
|
|||||||
|
|
||||||
{selectedProject && (
|
{selectedProject && (
|
||||||
<>
|
<>
|
||||||
<ProjectModal
|
<ProjectForm
|
||||||
mode="edit"
|
mode="edit"
|
||||||
existingProject={selectedProject.Project}
|
existingProject={selectedProject.Project}
|
||||||
open={editProjectOpen}
|
open={editProjectOpen}
|
||||||
@@ -863,7 +863,7 @@ function OrganisationsDialog({ trigger }: { trigger?: ReactNode }) {
|
|||||||
await invalidateProjects();
|
await invalidateProjects();
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
<SprintModal
|
<SprintForm
|
||||||
mode="edit"
|
mode="edit"
|
||||||
existingSprint={editingSprint ?? undefined}
|
existingSprint={editingSprint ?? undefined}
|
||||||
sprints={sprints}
|
sprints={sprints}
|
||||||
@@ -1112,4 +1112,4 @@ function OrganisationsDialog({ trigger }: { trigger?: ReactNode }) {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
export default OrganisationsDialog;
|
export default Organisations;
|
||||||
@@ -23,7 +23,7 @@ const keyify = (value: string) =>
|
|||||||
.replace(/[^A-Z0-9]/g, "")
|
.replace(/[^A-Z0-9]/g, "")
|
||||||
.slice(0, 4);
|
.slice(0, 4);
|
||||||
|
|
||||||
export function ProjectModal({
|
export function ProjectForm({
|
||||||
organisationId,
|
organisationId,
|
||||||
trigger,
|
trigger,
|
||||||
completeAction,
|
completeAction,
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
import { useEffect, useMemo, useState } from "react";
|
import { useEffect, useMemo, useState } from "react";
|
||||||
import { ProjectModal } from "@/components/project-modal";
|
import { ProjectForm } from "@/components/project-form";
|
||||||
import { useSelection } from "@/components/selection-provider";
|
import { useSelection } from "@/components/selection-provider";
|
||||||
import { Button } from "@/components/ui/button";
|
import { Button } from "@/components/ui/button";
|
||||||
import {
|
import {
|
||||||
@@ -81,7 +81,7 @@ export function ProjectSelect({
|
|||||||
))}
|
))}
|
||||||
{projects.length > 0 && <SelectSeparator />}
|
{projects.length > 0 && <SelectSeparator />}
|
||||||
</SelectGroup>
|
</SelectGroup>
|
||||||
<ProjectModal
|
<ProjectForm
|
||||||
organisationId={selectedOrganisationId ?? undefined}
|
organisationId={selectedOrganisationId ?? undefined}
|
||||||
trigger={
|
trigger={
|
||||||
<Button
|
<Button
|
||||||
|
|||||||
@@ -34,7 +34,7 @@ const isValidURL = (url: string) => {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
export function ServerConfigurationDialog({ trigger }: { trigger?: ReactNode }) {
|
export function ServerConfiguration({ trigger }: { trigger?: ReactNode }) {
|
||||||
const [open, setOpen] = useState(false);
|
const [open, setOpen] = useState(false);
|
||||||
const [serverURL, setServerURL] = useState(getServerURL());
|
const [serverURL, setServerURL] = useState(getServerURL());
|
||||||
const [originalURL, setOriginalURL] = useState(getServerURL());
|
const [originalURL, setOriginalURL] = useState(getServerURL());
|
||||||
@@ -48,7 +48,7 @@ const getDefaultDates = () => {
|
|||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
export function SprintModal({
|
export function SprintForm({
|
||||||
projectId,
|
projectId,
|
||||||
sprints,
|
sprints,
|
||||||
trigger,
|
trigger,
|
||||||
@@ -10,11 +10,7 @@ export function TimerModal({ issueId, disabled }: { issueId: number; disabled?:
|
|||||||
return (
|
return (
|
||||||
<Dialog open={open} onOpenChange={setOpen}>
|
<Dialog open={open} onOpenChange={setOpen}>
|
||||||
<DialogTrigger asChild disabled={disabled}>
|
<DialogTrigger asChild disabled={disabled}>
|
||||||
<Button
|
<Button variant="outline" size="sm" disabled={disabled}>
|
||||||
variant="outline"
|
|
||||||
size="sm"
|
|
||||||
disabled={disabled}
|
|
||||||
>
|
|
||||||
<Icon icon="timer" className="size-4" />
|
<Icon icon="timer" className="size-4" />
|
||||||
Timer
|
Timer
|
||||||
</Button>
|
</Button>
|
||||||
|
|||||||
@@ -2,17 +2,17 @@
|
|||||||
|
|
||||||
import { useEffect, useMemo, useRef } from "react";
|
import { useEffect, useMemo, useRef } from "react";
|
||||||
import { useLocation } from "react-router-dom";
|
import { useLocation } from "react-router-dom";
|
||||||
import AccountDialog from "@/components/account-dialog";
|
import Account from "@/components/account";
|
||||||
|
import { IssueForm } from "@/components/issue-form";
|
||||||
import { IssueDetailPane } from "@/components/issue-detail-pane";
|
import { IssueDetailPane } from "@/components/issue-detail-pane";
|
||||||
import { IssueModal } from "@/components/issue-modal";
|
|
||||||
import { IssuesTable } from "@/components/issues-table";
|
import { IssuesTable } from "@/components/issues-table";
|
||||||
import LogOutButton from "@/components/log-out-button";
|
import LogOutButton from "@/components/log-out-button";
|
||||||
import OrgIcon from "@/components/org-icon";
|
import OrgIcon from "@/components/org-icon";
|
||||||
import { OrganisationSelect } from "@/components/organisation-select";
|
import { OrganisationSelect } from "@/components/organisation-select";
|
||||||
import OrganisationsDialog from "@/components/organisations-dialog";
|
import Organisations from "@/components/organisations";
|
||||||
import { ProjectSelect } from "@/components/project-select";
|
import { ProjectSelect } from "@/components/project-select";
|
||||||
import { useSelection } from "@/components/selection-provider";
|
import { useSelection } from "@/components/selection-provider";
|
||||||
import { ServerConfigurationDialog } from "@/components/server-configuration-dialog";
|
import { ServerConfiguration } from "@/components/server-configuration";
|
||||||
import { useAuthenticatedSession } from "@/components/session-provider";
|
import { useAuthenticatedSession } from "@/components/session-provider";
|
||||||
import SmallUserDisplay from "@/components/small-user-display";
|
import SmallUserDisplay from "@/components/small-user-display";
|
||||||
import { Button } from "@/components/ui/button";
|
import { Button } from "@/components/ui/button";
|
||||||
@@ -199,14 +199,13 @@ export default function App() {
|
|||||||
)?.Organisation.slug || ""
|
)?.Organisation.slug || ""
|
||||||
}
|
}
|
||||||
size={7}
|
size={7}
|
||||||
className="hover:border hover:border-foreground/30"
|
|
||||||
/>
|
/>
|
||||||
}
|
}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
{selectedOrganisationId && <ProjectSelect showLabel />}
|
{selectedOrganisationId && <ProjectSelect showLabel />}
|
||||||
{selectedOrganisationId && selectedProjectId && (
|
{selectedOrganisationId && selectedProjectId && (
|
||||||
<IssueModal
|
<IssueForm
|
||||||
trigger={
|
trigger={
|
||||||
<IconButton variant={"outline"} className="w-9 h-9" title="Create Issue">
|
<IconButton variant={"outline"} className="w-9 h-9" title="Create Issue">
|
||||||
<Icon icon="plus" />
|
<Icon icon="plus" />
|
||||||
@@ -222,13 +221,13 @@ export default function App() {
|
|||||||
</DropdownMenuTrigger>
|
</DropdownMenuTrigger>
|
||||||
<DropdownMenuContent align={"end"}>
|
<DropdownMenuContent align={"end"}>
|
||||||
<DropdownMenuItem asChild className="flex items-end justify-end">
|
<DropdownMenuItem asChild className="flex items-end justify-end">
|
||||||
<AccountDialog />
|
<Account />
|
||||||
</DropdownMenuItem>
|
</DropdownMenuItem>
|
||||||
<DropdownMenuItem asChild className="flex items-end justify-end">
|
<DropdownMenuItem asChild className="flex items-end justify-end">
|
||||||
<OrganisationsDialog />
|
<Organisations />
|
||||||
</DropdownMenuItem>
|
</DropdownMenuItem>
|
||||||
<DropdownMenuItem asChild className="flex items-end justify-end">
|
<DropdownMenuItem asChild className="flex items-end justify-end">
|
||||||
<ServerConfigurationDialog
|
<ServerConfiguration
|
||||||
trigger={
|
trigger={
|
||||||
<Button
|
<Button
|
||||||
variant="ghost"
|
variant="ghost"
|
||||||
|
|||||||
Reference in New Issue
Block a user