Skip to content

Commit

Permalink
feat: more light mode fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
Gobot1234 committed Apr 16, 2024
1 parent 37b17c1 commit b03da1a
Show file tree
Hide file tree
Showing 7 changed files with 46 additions and 53 deletions.
2 changes: 1 addition & 1 deletion apps/anvil/dbschema/queries/addInPersonTraining.edgeql
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ user := (
update users::User
filter .id = <uuid>$id
set {
training := (
training += (
select .training {
@created_at := @created_at,
@in_person_created_at := <datetime>$created_at,
Expand Down
27 changes: 16 additions & 11 deletions apps/anvil/dbschema/queries/addInPersonTraining.query.ts
Original file line number Diff line number Diff line change
@@ -1,20 +1,24 @@
// GENERATED by @edgedb/generate v0.5.2

import type {Executor} from "edgedb";
import type { Executor } from "edgedb";

export type AddInPersonTrainingArgs = {
readonly "rep_id": string;
readonly "training_id": string;
readonly "created_at": Date;
readonly "id": string;
readonly rep_id: string;
readonly training_id: string;
readonly created_at: Date;
readonly id: string;
};

export type AddInPersonTrainingReturns = {
"id": string;
id: string;
};

export function addInPersonTraining(client: Executor, args: AddInPersonTrainingArgs): Promise<AddInPersonTrainingReturns> {
return client.queryRequiredSingle(`\
export function addInPersonTraining(
client: Executor,
args: AddInPersonTrainingArgs,
): Promise<AddInPersonTrainingReturns> {
return client.queryRequiredSingle(
`\
with rep := (
select users::Rep
filter .id = <uuid>$rep_id
Expand All @@ -23,7 +27,7 @@ user := (
update users::User
filter .id = <uuid>$id
set {
training := (
training += (
select .training {
@created_at := @created_at,
@in_person_created_at := <datetime>$created_at,
Expand All @@ -33,6 +37,7 @@ user := (
)
}
)
select assert_exists(user);`, args);

select assert_exists(user);`,
args,
);
}
9 changes: 1 addition & 8 deletions apps/anvil/src/users/users.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,7 @@ import { users } from "@ignis/types";
import { Location } from "@ignis/types/sign_in";
import { RepStatus, SignInStat, Training, User } from "@ignis/types/users";
import { ConflictException, Injectable, NotFoundException } from "@nestjs/common";
import {
CardinalityViolationError,
ConstraintViolationError,
Duration,
InvalidValueError,
RelativeDuration,
} from "edgedb";
import { parseHumanDurationString } from "edgedb/dist/datatypes/datetime";
import { CardinalityViolationError, ConstraintViolationError, Duration, InvalidValueError } from "edgedb";
import {
AddInPersonTrainingDto,
CreateInfractionDto,
Expand Down
2 changes: 1 addition & 1 deletion apps/forge/src/components/avatar/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ export const UserAvatar: React.FC<UserAvatarProps> = ({ user, className }) => {
return (
<Avatar className={cn("h-8 w-8 rounded-md", className)}>
<AvatarImage src={user.profile_picture || getGravatarUrl(user.email)} alt={user.email} />
<AvatarFallback>{user_initials}</AvatarFallback>
<AvatarFallback className="text-black dark:text-white">{user_initials}</AvatarFallback>
</Avatar>
);
};
Original file line number Diff line number Diff line change
@@ -1,23 +1,23 @@
import { Card } from "@ui/components/ui/card.tsx";
import { LogOut, Plus } from "lucide-react";
import { Button } from "@ui/components/ui/button.tsx";
import { UserAvatar } from "@/components/avatar";
import { AddToUser } from "@/components/signin/dashboard/components/SignedInUserCard/subcomponents/AddToUser.tsx";
import { SignInReasonDisplay } from "@/components/signin/dashboard/components/SignedInUserCard/subcomponents/SignInReasonDisplay.tsx";
import TeamIcon from "@/components/signin/dashboard/components/TeamIcon.tsx";
import { REP_OFF_SHIFT, REP_ON_SHIFT } from "@/lib/constants.ts";
import { AppRootState } from "@/redux/store.ts";
import { PostSignOut, PostSignOutProps } from "@/services/signin/signInService.ts";
import type { PartialReason, SignInEntry } from "@ignis/types/sign_in.ts";
import type { PartialUser } from "@ignis/types/users.ts";
import { useSelector } from "react-redux";
import { AppRootState } from "@/redux/store.ts";
import { useMutation, useQueryClient } from "@tanstack/react-query";
import { REP_OFF_SHIFT, REP_ON_SHIFT } from "@/lib/constants.ts";
import { PostSignOut, PostSignOutProps } from "@/services/signin/signInService.ts";
import { toast } from "sonner";
import { Link } from "@tanstack/react-router";
import * as React from "react";
import TeamIcon from "@/components/signin/dashboard/components/TeamIcon.tsx";
import { UserAvatar } from "@/components/avatar";
import { SignInReasonDisplay } from "@/components/signin/dashboard/components/SignedInUserCard/subcomponents/SignInReasonDisplay.tsx";
import { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from "@ui/components/ui/tooltip.tsx";
import { Popover, PopoverContent, PopoverTrigger } from "@ui/components/ui/popover.tsx";
import { Badge } from "@ui/components/ui/badge.tsx";
import { AddToUser } from "@/components/signin/dashboard/components/SignedInUserCard/subcomponents/AddToUser.tsx";
import { Button } from "@ui/components/ui/button.tsx";
import { Card } from "@ui/components/ui/card.tsx";
import { Popover, PopoverContent, PopoverTrigger } from "@ui/components/ui/popover.tsx";
import { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from "@ui/components/ui/tooltip.tsx";
import { LogOut, Plus } from "lucide-react";
import * as React from "react";
import { useSelector } from "react-redux";
import { toast } from "sonner";

interface SignInUserCardProps {
user: SignInEntry["user"];
Expand Down Expand Up @@ -69,22 +69,17 @@ export const SignedInUserCard: React.FunctionComponent<SignInUserCardProps> = ({
const shouldDisplayReason = !(reason?.name === REP_ON_SHIFT || reason?.name === REP_OFF_SHIFT);

return (
<Card
className="bg-card w-[240px] md:w-[300px] p-4 rounded-lg flex
flex-col justify-between text-white"
>
<Card className="bg-card w-[240px] md:w-[300px] p-4 rounded-lg flex flex-col justify-between text-black dark:text-white">
<div>
<div className="flex items-center justify-between mb-4">
<div className="mt-1 ml-1">
<Link to={`/users/${user.id}` as string}>
<h2 className="w-full text-center text-lg font-bold hover:underline text-black dark:text-white">
{user.display_name}
</h2>
<h2 className="w-full text-center text-lg font-bold hover:underline">{user.display_name}</h2>
</Link>
{user.teams?.map((team) => (
<Badge className="flex items-center justify-start rounded-sm bg-neutral-800 m-0.5 w-full pt-1.5 pb-1.5">
<TeamIcon team={team.name} className="stroke-white mr-1 h-4 w-4" />
<text className="text-left ml-2 text-xs text-white">{team.name}</text>
<Badge className="flex items-center justify-start rounded-sm bg-accent dark:bg-neutral-800 m-0.5 w-full pt-1.5 pb-1.5 text-black dark:text-white">
<TeamIcon team={team.name} className="stroke-black dark:stroke-white mr-1 h-4 w-4" />
<text className="text-left ml-2 text-xs">{team.name}</text>
</Badge>
))}
</div>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import type { PartialUser } from "@ignis/types/users.ts";
import type { Location } from "@ignis/types/sign_in.ts";
import * as React from "react";
import { TrainingSection } from "@/components/signin/dashboard/components/SignedInUserCard/subcomponents/TrainingSection.tsx";
import { InfractionSection } from "@/components/signin/dashboard/components/SignedInUserCard/subcomponents/InfractionSection.tsx";
import { TrainingSection } from "@/components/signin/dashboard/components/SignedInUserCard/subcomponents/TrainingSection.tsx";
import type { Location } from "@ignis/types/sign_in.ts";
import type { PartialUser } from "@ignis/types/users.ts";
import { Button } from "@ui/components/ui/button.tsx";
import { Separator } from "@ui/components/ui/separator.tsx";
import * as React from "react";

type Addable = "Training" | "Infraction";

Expand Down Expand Up @@ -53,7 +53,7 @@ export const AddToUser: React.FC<AddToUserProps> = ({ user, location, onShiftRep
}`}
onClick={() => setSection(title)}
>
<text className={`${title === section ? "font-bold" : ""}`}>Add {title}</text>
<text className={`${title === section ? "font-bold text-white" : ""}`}>Add {title}</text>
</Button>
);
})}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ interface SignInReasonDisplayProps {
export const SignInReasonDisplay: React.FC<SignInReasonDisplayProps> = ({ tools, reason }) => {
return (
<>
<div className="my-4 px-4 py-3 bg-neutral-800 rounded-lg">
<div className="my-4 px-4 py-3 bg-accent dark:bg-neutral-800 rounded-lg">
<div className="border-gray-500 p-2 rounded-lg mb-2">
<div className="border-b border-gray-500 pb-2 font-medium mb-1 text-center font-mono">Sign In Reason</div>
<div className="text-center font-mono ">{reason.name}</div>
Expand All @@ -18,7 +18,7 @@ export const SignInReasonDisplay: React.FC<SignInReasonDisplayProps> = ({ tools,
<div className="border-b border-gray-500 pb-2 font-medium mb-1 text-center font-mono">Tools Used</div>
<div className="flex flex-wrap gap-1">
{tools.map((tool) => (
<Badge variant="default" className="max-w-48">
<Badge variant="default" className="max-w-48 rounded-sm">
{tool}
</Badge>
))}
Expand Down

0 comments on commit b03da1a

Please sign in to comment.