Skip to content

Commit

Permalink
chore: refactor components directory to better co-locate components w…
Browse files Browse the repository at this point in the history
…ith their intended routes
  • Loading branch information
Sampiiiii committed May 9, 2024
1 parent 4252a0c commit 65f0897
Show file tree
Hide file tree
Showing 39 changed files with 121 additions and 129 deletions.
29 changes: 0 additions & 29 deletions apps/forge/src/components/signin/actions/SignInReason.tsx

This file was deleted.

3 changes: 1 addition & 2 deletions apps/forge/src/components/ucard-reader/index.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
import { signinActions } from "@/redux/signin.slice";
import { AppDispatch, AppRootState } from "@/redux/store";
import { GetSignIn, PostSignOut } from "@/services/signin/signInService";
import { User } from "@ignis/types/sign_in";
import { useQueryClient } from "@tanstack/react-query";
import { Link, useNavigate } from "@tanstack/react-router";
import { useNavigate } from "@tanstack/react-router";
import { Button } from "@ui/components/ui/button";
import { useEffect, useState } from "react";
import { useDispatch, useSelector } from "react-redux";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import QueueDispatcher from "@/components/signin/actions/QueueDispatcher.tsx";
import SignInDispatcher from "@/components/signin/actions/SignInDispatcher.tsx";
import SignInFlowProgress from "@/components/signin/actions/SignInFlowProgress.tsx";
import SignInReasonInput from "@/components/signin/actions/SignInReasonInput.tsx";
import SignOutDispatcher from "@/components/signin/actions/SignOutDispatcher.tsx";
import ToolSelectionInput from "@/components/signin/actions/ToolSelectionInput.tsx";
import UCardInput from "@/components/signin/actions/UCardInput.tsx";
import QueueDispatcher from "@/routes/_authenticated/_reponly/signin/actions/-components/QueueDispatcher.tsx";
import SignInDispatcher from "@/routes/_authenticated/_reponly/signin/actions/-components/SignInDispatcher.tsx";
import SignInFlowProgress from "@/routes/_authenticated/_reponly/signin/actions/-components/SignInFlowProgress.tsx";
import SignInReasonInput from "@/routes/_authenticated/_reponly/signin/actions/-components/SignInReasonInput.tsx";
import SignOutDispatcher from "@/routes/_authenticated/_reponly/signin/actions/-components/SignOutDispatcher.tsx";
import ToolSelectionInput from "@/routes/_authenticated/_reponly/signin/actions/-components/ToolSelectionInput.tsx";
import UCardInput from "@/routes/_authenticated/_reponly/signin/actions/-components/UCardInput.tsx";
import useDoubleTapEscape from "@/hooks/useDoubleTapEscape.ts";
import { signinActions, useSignInSessionField } from "@/redux/signin.slice.ts";
import { AppDispatch, AppRootState } from "@/redux/store.ts";
Expand All @@ -23,7 +23,7 @@ import { useNavigate } from "@tanstack/react-router";
import { Button } from "@ui/components/ui/button.tsx";
import React, { ReactElement, useEffect, useLayoutEffect, useState } from "react";
import { useDispatch, useSelector } from "react-redux";
import SigningInUserCard from "./SigningInUserCard";
import SigningInUserCard from "./SigningInUserCard.tsx";

const flowConfig: FlowConfiguration = {
[FlowType.SignIn]: {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
import { Category } from "@/components/icons/SignInReason.tsx";
import { cn } from "@/lib/utils.ts";
import { PartialReason } from "@ignis/types/sign_in.ts";
import { Badge } from "@ui/components/ui/badge.tsx";
import { TooltipProvider, Tooltip, TooltipTrigger, TooltipContent } from "@ui/components/ui/tooltip.tsx";

export const SignInReason = ({ reason, className }: { reason: PartialReason; className?: string }) => {
return (
<TooltipProvider>
<Tooltip>
<TooltipTrigger asChild>
<div className="text-center font-mono mt-2 flex justify-center">
<Badge
variant="default"
className={cn("max-w-48 rounded-sm shadow-lg justify-center items-center", className)}
>
{<Category category={reason.category} className="mr-1" />}
{reason.category === "UNIVERSITY_MODULE" ? reason.name.split(" ")[0] : reason.name}
</Badge>
</div>
</TooltipTrigger>
<TooltipContent>
<p>{reason.name}</p>
</TooltipContent>
</Tooltip>
</TooltipProvider>
);
};
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
import Fuse from 'fuse.js';
import React, { useEffect, useState } from 'react';
import { AppDispatch, AppRootState } from '@/redux/store.ts';
import { Button } from '@ui/components/ui/button.tsx';
import { Card, CardContent, CardDescription, CardFooter, CardHeader, CardTitle } from '@ui/components/ui/card.tsx';
import { Category } from '@/components/icons/SignInReason.tsx';
import { errorDisplay, ErrorDisplayProps } from '@/components/errors/ErrorDisplay';
import { extractError } from '@/lib/utils';
import { FlowStepComponent } from '@/types/signInActions.ts';
import { getCommonReasons, useSignInReasons } from '@/services/signin/signInReasonService.ts';
import { Input } from '@ui/components/ui/input.tsx';
import { Loader } from '@ui/components/ui/loader.tsx';
import type { PartialReason, Reason } from '@ignis/types/sign_in.ts';
import { signinActions, useSignInSessionField } from '@/redux/signin.slice.ts';
import { SignInReason } from './SignInReason';
import { useDispatch, useSelector } from 'react-redux';
import { useQuery } from '@tanstack/react-query';
import Fuse from "fuse.js";
import React, { useEffect, useState } from "react";
import { AppDispatch, AppRootState } from "@/redux/store.ts";
import { Button } from "@ui/components/ui/button.tsx";
import { Card, CardContent, CardDescription, CardFooter, CardHeader, CardTitle } from "@ui/components/ui/card.tsx";
import { Category } from "@/components/icons/SignInReason.tsx";
import { errorDisplay, ErrorDisplayProps } from "@/components/errors/ErrorDisplay";
import { extractError } from "@/lib/utils.ts";
import { FlowStepComponent } from "@/types/signInActions.ts";
import { getCommonReasons, useSignInReasons } from "@/services/signin/signInReasonService.ts";
import { Input } from "@ui/components/ui/input.tsx";
import { Loader } from "@ui/components/ui/loader.tsx";
import type { PartialReason, Reason } from "@ignis/types/sign_in.ts";
import { signinActions, useSignInSessionField } from "@/redux/signin.slice.ts";
import { SignInReason } from "./SignInReason.tsx";
import { useDispatch, useSelector } from "react-redux";
import { useQuery } from "@tanstack/react-query";

const SignInReasonInput: FlowStepComponent = ({ onSecondary, onPrimary }) => {
const [inputValue, setInputValue] = useState<string>("");
Expand Down Expand Up @@ -137,14 +137,13 @@ const SignInReasonInput: FlowStepComponent = ({ onSecondary, onPrimary }) => {
<Loader />
) : (
<div className="flex">
{commonReasons?.map((reason) => (
<div onClick={() => setSelectedReason(reason)} className="flex hover:cursor-pointer m-1">
<SignInReason reason={reason} />
</div>
))}
{commonReasons?.map((reason) => (
<div onClick={() => setSelectedReason(reason)} className="flex hover:cursor-pointer m-1">
<SignInReason reason={reason} />
</div>
))}
</div>
)
}
)}
</CardHeader>
<CardContent>
{isLoading && <Loader />}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { UserAvatar } from "@/components/avatar";
import { TeamIcon } from "@/components/icons/Team";
import { TeamIcon } from "@/components/icons/Team.tsx";
import { sign_in } from "@ignis/types";
import { Link } from "@tanstack/react-router";
import { Badge } from "@ui/components/ui/badge";
import { Card } from "@ui/components/ui/card";
import { Badge } from "@ui/components/ui/badge.tsx";
import { Card } from "@ui/components/ui/card.tsx";

export default function SigningInUserCard({ user }: { user: sign_in.User }) {
return (
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { errorDisplay } from "@/components/errors/ErrorDisplay";
import { SelectedTrainingPipDisplay } from "@/components/signin/actions/SelectedTrainingPipDisplay.tsx";
import ToolSelectionList from "@/components/signin/actions/TrainingSelectionList.tsx";
import { SelectedTrainingPipDisplay } from "@/routes/_authenticated/_reponly/signin/actions/-components/SelectedTrainingPipDisplay.tsx";
import ToolSelectionList from "@/routes/_authenticated/_reponly/signin/actions/-components/TrainingSelectionList.tsx";
import { signinActions, useSignInSessionField } from "@/redux/signin.slice.ts";
import { AppDispatch, AppRootState } from "@/redux/store.ts";
import { GetSignIn, GetSignInProps } from "@/services/signin/signInService.ts";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import TrainingDisplay from "@/components/signin/actions/TrainingDisplay.tsx";
import TrainingDisplay from "@/routes/_authenticated/_reponly/signin/actions/-components/TrainingDisplay.tsx";
import { cn } from "@/lib/utils.ts";
import { Training } from "@ignis/types/sign_in.ts";
import { ExclamationTriangleIcon } from "@radix-ui/react-icons";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { UCARD_LENGTH } from "@/lib/constants";
import { UCARD_LENGTH } from "@/lib/constants.ts";
import { signinActions, useSignInSessionField } from "@/redux/signin.slice.ts";
import { AppDispatch } from "@/redux/store.ts";
import { FlowStepComponent } from "@/types/signInActions.ts";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { createFileRoute } from "@tanstack/react-router";
import ActiveLocationSelector from "@/components/signin/ActiveLocationSelector";
import SignInActionsManager from "@/components/signin/actions/SignInManager.tsx";
import SignInActionsManager from "@/routes/_authenticated/_reponly/signin/actions/-components/SignInManager.tsx";
import { FlowType } from "@/types/signInActions.ts";
import Title from "@/components/title";

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import ActiveLocationSelector from "@/components/signin/ActiveLocationSelector";
import SignInActionsManager from "@/components/signin/actions/SignInManager";
import SignInActionsManager from "@/routes/_authenticated/_reponly/signin/actions/-components/SignInManager.tsx";
import Title from "@/components/title";
import { FlowType, SignInSteps } from "@/types/signInActions";
import { createFileRoute } from "@tanstack/react-router";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import ActiveLocationSelector from "@/components/signin/ActiveLocationSelector";
import SignInActionsManager from "@/components/signin/actions/SignInManager.tsx";
import SignInActionsManager from "@/routes/_authenticated/_reponly/signin/actions/-components/SignInManager.tsx";
import { FlowType } from "@/types/signInActions.ts";
import Title from "@/components/title";
import { createFileRoute } from "@tanstack/react-router";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { createFileRoute } from "@tanstack/react-router";
import ActiveLocationSelector from "@/components/signin/ActiveLocationSelector";
import SignInActionsManager from "@/components/signin/actions/SignInManager.tsx";
import SignInActionsManager from "@/routes/_authenticated/_reponly/signin/actions/-components/SignInManager.tsx";
import { FlowType } from "@/types/signInActions.ts";
import Title from "@/components/title";

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import ActiveLocationSelector from "@/components/signin/ActiveLocationSelector";
import SignInActionsManager from "@/components/signin/actions/SignInManager.tsx";
import SignInActionsManager from "@/routes/_authenticated/_reponly/signin/actions/-components/SignInManager.tsx";
import { FlowType } from "@/types/signInActions.ts";
import Title from "@/components/title";
import { createFileRoute } from "@tanstack/react-router";
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
import { UserAvatar } from "@/components/avatar";
import { iForgeEpoch } from "@/config/constants";
import { useUser } from "@/lib/utils";
import { AppRootState } from "@/redux/store";
import { DeleteQueue } from "@/services/signin/queueService";
import { QueueEntry } from "@ignis/types/sign_in";
import { iForgeEpoch } from "@/config/constants.ts";
import { useUser } from "@/lib/utils.ts";
import { AppRootState } from "@/redux/store.ts";
import { DeleteQueue } from "@/services/signin/queueService.ts";
import { QueueEntry } from "@ignis/types/sign_in.ts";
import { useMutation, useQueryClient } from "@tanstack/react-query";
import { Link } from "@tanstack/react-router";
import { Button } from "@ui/components/ui/button";
import { Card } from "@ui/components/ui/card";
import { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from "@ui/components/ui/tooltip";
import { Button } from "@ui/components/ui/button.tsx";
import { Card } from "@ui/components/ui/card.tsx";
import { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from "@ui/components/ui/tooltip.tsx";
import { Delete } from "lucide-react";
import { useSelector } from "react-redux";
import { toast } from "sonner";
import { AdminDisplay } from "./SignedInUserCard/AdminDisplay";
import { TimeDisplay } from "./SignedInUserCard/TimeDisplay";
import { AdminDisplay } from "./SignedInUserCard/AdminDisplay.tsx";
import { TimeDisplay } from "./SignedInUserCard/TimeDisplay.tsx";

interface QueuedUserCardProps {
place: QueueEntry;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { SignedInUserCard } from "@/components/signin/dashboard/components/SignedInUserCard";
import { SignedInUserCard } from "@/routes/_authenticated/_reponly/signin/dashboard/-components/SignedInUserCard";
import type { SignInEntry } from "@ignis/types/sign_in.ts";
import { PartialUserWithTeams } from "@ignis/types/users.ts";
import { InfoCircledIcon } from "@radix-ui/react-icons";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import { LocationIcon } from "@/components/icons/Locations";
import { SignInStat } from "@ignis/types/users";
import { LocationIcon } from "@/components/icons/Locations.tsx";
import { SignInStat } from "@ignis/types/users.ts";
import { Datum, ResponsiveCalendar } from "@nivo/calendar";
import { Link, useNavigate } from "@tanstack/react-router";
import { Button } from "@ui/components/ui/button";
import { Dialog, DialogContent, DialogHeader, DialogTitle } from "@ui/components/ui/dialog";
import { Drawer, DrawerClose, DrawerContent, DrawerFooter, DrawerHeader, DrawerTitle } from "@ui/components/ui/drawer";
import { Table, TableBody, TableCell, TableHead, TableHeader, TableRow } from "@ui/components/ui/table";
import { Button } from "@ui/components/ui/button.tsx";
import { Dialog, DialogContent, DialogHeader, DialogTitle } from "@ui/components/ui/dialog.tsx";
import { Drawer, DrawerClose, DrawerContent, DrawerFooter, DrawerHeader, DrawerTitle } from "@ui/components/ui/drawer.tsx";
import { Table, TableBody, TableCell, TableHead, TableHeader, TableRow } from "@ui/components/ui/table.tsx";
import * as React from "react";
import MediaQuery from "react-responsive";

Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import { InfractionSection } from "@/components/signin/dashboard/components/SignedInUserCard/InfractionSection.tsx";
import { TrainingSection } from "@/components/signin/dashboard/components/SignedInUserCard/TrainingSection.tsx";
import { InfractionSection } from "@/routes/_authenticated/_reponly/signin/dashboard/-components/SignedInUserCard/InfractionSection.tsx";
import { TrainingSection } from "@/routes/_authenticated/_reponly/signin/dashboard/-components/SignedInUserCard/TrainingSection.tsx";
import type { Location } from "@ignis/types/sign_in.ts";
import { PartialUserWithTeams } from "@ignis/types/users.ts";
import { Tabs, TabsContent, TabsList, TabsTrigger } from "@ui/components/ui/tabs.tsx";
import * as React from "react";
import { TeamManagementSection } from "@/components/signin/dashboard/components/SignedInUserCard/TeamManagementSection.tsx";
import { TeamManagementSection } from "@/routes/_authenticated/_reponly/signin/dashboard/-components/SignedInUserCard/TeamManagementSection.tsx";
import { useAuth } from "@/components/auth-provider";
import posthog from "posthog-js";

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { SignInReason } from "@/components/signin/actions/SignInReason";
import { SignInReason } from "@/routes/_authenticated/_reponly/signin/actions/-components/SignInReason.tsx";
import { PartialReason } from "@ignis/types/sign_in.ts";
import { Badge } from "@ui/components/ui/badge.tsx";

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import TeamIcon from "@/components/icons/Team";
import { ManageUserWidgetProps } from "@/components/signin/dashboard/components/SignedInUserCard/ManageUserWidget.tsx";
import TeamIcon from "@/components/icons/Team.tsx";
import { ManageUserWidgetProps } from "@/routes/_authenticated/_reponly/signin/dashboard/-components/SignedInUserCard/ManageUserWidget.tsx";
import { getTeams } from "@/services/users/getTeams.ts";
import promoteToRep from "@/services/users/promoteToRep.ts";
import { zodResolver } from "@hookform/resolvers/zod";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import { format } from "date-fns";
import { Calendar } from "@ui/components/ui/calendar.tsx";
import addInPersonTraining from "@/services/users/addInPersonTraining.ts";
import { toast } from "sonner";
import { ManageUserWidgetProps } from "@/components/signin/dashboard/components/SignedInUserCard/ManageUserWidget.tsx";
import { ManageUserWidgetProps } from "@/routes/_authenticated/_reponly/signin/dashboard/-components/SignedInUserCard/ManageUserWidget.tsx";

export const TrainingSection: React.FC<ManageUserWidgetProps> = ({ user, location, onShiftReps }) => {
const [date, setDate] = React.useState<Date | undefined>(new Date());
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import { UserAvatar } from "@/components/avatar";
import { TeamIcon } from "@/components/icons/Team";
import { AdminDisplay } from "@/components/signin/dashboard/components/SignedInUserCard/AdminDisplay.tsx";
import { ManageUserWidget } from "@/components/signin/dashboard/components/SignedInUserCard/ManageUserWidget.tsx";
import { SignInReasonWithToolsDisplay } from "@/components/signin/dashboard/components/SignedInUserCard/SignInReasonDisplay.tsx";
import { TimeDisplay } from "@/components/signin/dashboard/components/SignedInUserCard/TimeDisplay.tsx";
import { TeamIcon } from "@/components/icons/Team.tsx";
import { AdminDisplay } from "@/routes/_authenticated/_reponly/signin/dashboard/-components/SignedInUserCard/AdminDisplay.tsx";
import { ManageUserWidget } from "@/routes/_authenticated/_reponly/signin/dashboard/-components/SignedInUserCard/ManageUserWidget.tsx";
import { SignInReasonWithToolsDisplay } from "@/routes/_authenticated/_reponly/signin/dashboard/-components/SignedInUserCard/SignInReasonDisplay.tsx";
import { TimeDisplay } from "@/routes/_authenticated/_reponly/signin/dashboard/-components/SignedInUserCard/TimeDisplay.tsx";
import { iForgeEpoch } from "@/config/constants.ts";
import { REP_OFF_SHIFT, REP_ON_SHIFT } from "@/lib/constants.ts";
import { uCardNumberToString } from "@/lib/utils";
import { uCardNumberToString } from "@/lib/utils.ts";
import { AppRootState } from "@/redux/store.ts";
import { PostSignOut, PostSignOutProps } from "@/services/signin/signInService.ts";
import type { PartialReason } from "@ignis/types/sign_in.ts";
Expand Down
Loading

0 comments on commit 65f0897

Please sign in to comment.