Skip to content

Commit

Permalink
feat: Atualiza dependência e ajustes de layout
Browse files Browse the repository at this point in the history
  • Loading branch information
ErickCReis committed May 12, 2024
1 parent 9a2e566 commit c878ff3
Show file tree
Hide file tree
Showing 14 changed files with 609 additions and 611 deletions.
18 changes: 9 additions & 9 deletions apps/nextjs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,34 +21,34 @@
"@acme/validators": "workspace:*",
"@hookform/resolvers": "^3.3.4",
"@t3-oss/env-nextjs": "^0.10.1",
"@tanstack/react-query": "^5.32.0",
"@tanstack/react-query": "^5.36.0",
"@trpc/client": "11.0.0-rc.334",
"@trpc/react-query": "11.0.0-rc.334",
"@trpc/server": "11.0.0-rc.334",
"@ts-react/form": "^1.1.3",
"@vercel/analytics": "^1.2.2",
"@vercel/speed-insights": "^1.0.10",
"clsx": "^2.1.1",
"dayjs": "^1.11.7",
"dayjs": "^1.11.11",
"geist": "^1.3.0",
"lucide-react": "^0.376.0",
"lucide-react": "^0.378.0",
"next": "^14.2.3",
"react": "18.3.1",
"react-dom": "18.3.1",
"react-hook-form": "^7.51.1",
"react-hook-form": "^7.51.4",
"superjson": "2.2.1",
"zod": "^3.23.4"
"zod": "^3.23.8"
},
"devDependencies": {
"@acme/eslint-config": "workspace:*",
"@acme/prettier-config": "workspace:*",
"@acme/tailwind-config": "workspace:*",
"@acme/tsconfig": "workspace:*",
"@types/node": "^20.12.5",
"@types/react": "^18.3.1",
"@types/node": "^20.12.11",
"@types/react": "^18.3.2",
"@types/react-dom": "^18.3.0",
"dotenv-cli": "^7.4.1",
"eslint": "^9.1.1",
"dotenv-cli": "^7.4.2",
"eslint": "^9.2.0",
"jiti": "^1.21.0",
"prettier": "^3.2.5",
"tailwindcss": "^3.4.3",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
"use client";

import { useMemo } from "react";
import { useMemo, useState } from "react";
import Link from "next/link";
import { CalendarIcon, ChevronLeft, ChevronRight, FileUp } from "lucide-react";

Expand All @@ -9,7 +9,17 @@ import { cn } from "@acme/ui";
import { Button } from "@acme/ui/button";
import { Calendar } from "@acme/ui/calendar";
import { Dialog, DialogContent, DialogTrigger } from "@acme/ui/dialog";
import { Form, FormControl, FormField, FormItem, useForm } from "@acme/ui/form";
import {
Form,
FormControl,
FormDescription,
FormField,
FormItem,
FormLabel,
FormMessage,
useForm,
} from "@acme/ui/form";
import { Input } from "@acme/ui/input";
import { Popover, PopoverContent, PopoverTrigger } from "@acme/ui/popover";
import {
Tooltip,
Expand Down Expand Up @@ -102,22 +112,19 @@ const DayRow: React.FC<{
))}
</div>

{balanceTime && (
<div className={"w-16 font-semibold"}>
{displayTime({ date: totalTime })}
</div>
)}
<div className={cn("w-16 font-semibold", !balanceTime && "text-red-500")}>
{balanceTime ? displayTime({ date: totalTime }) : "--"}
</div>

{balanceTime && (
<div
className={cn(
"w-16 font-semibold",
hasDebit ? "text-red-500" : "text-green-500",
)}
>
{displayTime({ date: balanceTime })}
</div>
)}
<div
className={cn(
"w-16 font-semibold",
hasDebit ? "text-red-500" : "text-green-500",
!balanceTime && "text-red-500",
)}
>
{balanceTime ? displayTime({ date: balanceTime }) : "--"}
</div>
</div>
);
};
Expand All @@ -126,6 +133,7 @@ const AddTime: React.FC<{ teamId: string; date: Dayjs }> = ({
teamId,
date,
}) => {
const [calendarOpen, setCalendarOpen] = useState(false);
const utils = api.useUtils();

const createTimeRecord = api.timeRecord.create.useMutation({
Expand Down Expand Up @@ -155,27 +163,56 @@ const AddTime: React.FC<{ teamId: string; date: Dayjs }> = ({
name="time"
render={({ field }) => (
<FormItem>
<FormControl>
<Popover>
<PopoverTrigger asChild>
<Popover
open={calendarOpen}
onOpenChange={(open) => setCalendarOpen(open)}
>
<PopoverTrigger asChild>
<FormControl>
<Button
variant={"outline"}
className="justify-start rounded-r-none text-left font-normal"
variant="outline"
className="w-full rounded-r-none pl-3 text-left font-normal"
>
<CalendarIcon className="mr-2 h-4 w-4" />
{displayTime({ date: field.value, format: "DD/MM/YYYY" })}
{displayTime({
date: field.value,
format: "DD/MM/YYYY • HH[h]mm",
})}
</Button>
</PopoverTrigger>
<PopoverContent className="w-auto p-0">
<Calendar
mode="single"
selected={field.value}
onSelect={field.onChange}
initialFocus
/>
</PopoverContent>
</Popover>
</FormControl>
</FormControl>
</PopoverTrigger>
<PopoverContent className="w-auto">
<Calendar
className="p-0"
mode="single"
selected={field.value}
onSelect={field.onChange}
disabled={(date) =>
date > new Date() || date < new Date("1900-01-01")
}
initialFocus
/>
<Input
type="time"
className="mt-2"
// take locale date time string in format that the input expects (24hr time)
value={field.value.toLocaleTimeString([], {
hourCycle: "h23",
hour: "2-digit",
minute: "2-digit",
})}
// take hours and minutes and update our Date object then change date object to our new value
onChange={(selectedTime) => {
const currentTime = field.value;
currentTime.setHours(
parseInt(selectedTime.target.value.split(":")[0]),
parseInt(selectedTime.target.value.split(":")[1]),
0,
);
field.onChange(currentTime);
}}
/>
</PopoverContent>
</Popover>
</FormItem>
)}
/>
Expand Down
2 changes: 0 additions & 2 deletions apps/nextjs/src/app/team/[teamId]/@tabs/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@ import { Clock } from "../_components/clock";
import { MarkTime } from "../_components/mark-time";
import { RegisteredTimes } from "../_components/registered-times";

export const revalidate = 0;

export default async function Page({ params }: { params: { teamId: string } }) {
const team = await api.team.get(params.teamId);

Expand Down
43 changes: 16 additions & 27 deletions apps/nextjs/src/app/team/[teamId]/_components/user-info.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,37 +16,26 @@ export function UserInfo({
return null;
}

const info = {
Nome: teamMember.name,
Email: teamMember.email,
Cargo: teamMember.role,
Entrada: displayTime({
date: dayjs(teamMember.createdAt),
format: "DD/MM/YYYY",
}),
};

return (
<>
<div className="flex flex-col gap-2">
<div className="flex items-center gap-4">
<div className="font-semibold">Nome</div>
<div className=" flex-1 border-b border-dashed border-primary"></div>
<div>{teamMember.name}</div>
</div>

<div className="flex items-center gap-4">
<div className="font-semibold">Email</div>
<div className=" flex-1 border-b border-dashed border-primary"></div>
<div>{teamMember.email}</div>
</div>

<div className="flex items-center gap-4">
<div className="font-semibold">Cargo</div>
<div className=" flex-1 border-b border-dashed border-primary"></div>
<div>{teamMember.role}</div>
</div>

<div className="flex items-center gap-4">
<div className="font-semibold">Entrada</div>
<div className=" flex-1 border-b border-dashed border-primary"></div>
<div>
{displayTime({
date: dayjs(teamMember.createdAt),
format: "DD/MM/YYYY",
})}
{Object.entries(info).map(([key, value]) => (
<div key={key} className="flex items-center gap-4">
<div className="font-semibold">{key}</div>
<div className=" flex-1 border-b border-dashed border-secondary"></div>
<div>{value}</div>
</div>
</div>
))}
</div>

<h2 className="text-xl font-semibold">Relatório</h2>
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"engines": {
"node": ">=20.12.0"
},
"packageManager": "pnpm@9.0.6",
"packageManager": "pnpm@9.1.0",
"scripts": {
"build": "turbo build",
"clean": "git clean -xdf node_modules",
Expand Down
4 changes: 2 additions & 2 deletions packages/api/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,13 @@
"@acme/validators": "workspace:*",
"@trpc/server": "11.0.0-rc.334",
"superjson": "2.2.1",
"zod": "^3.23.4"
"zod": "^3.23.8"
},
"devDependencies": {
"@acme/eslint-config": "workspace:*",
"@acme/prettier-config": "workspace:*",
"@acme/tsconfig": "workspace:*",
"eslint": "^9.1.1",
"eslint": "^9.2.0",
"prettier": "^3.2.5",
"typescript": "^5.4.5"
},
Expand Down
4 changes: 3 additions & 1 deletion packages/api/src/router/time-record.ts
Original file line number Diff line number Diff line change
Expand Up @@ -171,8 +171,10 @@ export const timeRecordRouter = {
);

lastMonthBalance += monthBalance;

const label = `${year}/${(Number(month) + 1).toString().padStart(2, "0")}`;
historyResult.push({
label: `${year}/${Number(month) + 1}`,
label,
balance: monthBalance,
accumulatedBalance: lastMonthBalance,
});
Expand Down
6 changes: 3 additions & 3 deletions packages/auth/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,19 +19,19 @@
},
"dependencies": {
"@acme/db": "workspace:*",
"@auth/drizzle-adapter": "^1.0.1",
"@auth/drizzle-adapter": "^1.1.0",
"@t3-oss/env-nextjs": "^0.10.1",
"next": "^14.2.3",
"next-auth": "5.0.0-beta.17",
"react": "18.3.1",
"react-dom": "18.3.1",
"zod": "^3.23.4"
"zod": "^3.23.8"
},
"devDependencies": {
"@acme/eslint-config": "workspace:*",
"@acme/prettier-config": "workspace:*",
"@acme/tsconfig": "workspace:*",
"eslint": "^9.1.1",
"eslint": "^9.2.0",
"prettier": "^3.2.5",
"typescript": "^5.4.5"
},
Expand Down
12 changes: 6 additions & 6 deletions packages/db/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,18 +22,18 @@
"with-env": "dotenv -e ../../.env --"
},
"dependencies": {
"@neondatabase/serverless": "^0.9.1",
"@neondatabase/serverless": "^0.9.3",
"@t3-oss/env-core": "^0.10.1",
"drizzle-orm": "^0.30.9",
"zod": "^3.23.4"
"drizzle-orm": "^0.30.10",
"zod": "^3.23.8"
},
"devDependencies": {
"@acme/eslint-config": "workspace:*",
"@acme/prettier-config": "workspace:*",
"@acme/tsconfig": "workspace:*",
"dotenv-cli": "^7.4.1",
"drizzle-kit": "^0.20.14",
"eslint": "^9.1.1",
"dotenv-cli": "^7.4.2",
"drizzle-kit": "^0.21.1",
"eslint": "^9.2.0",
"pg": "^8.11.5",
"prettier": "^3.2.5",
"typescript": "^5.4.5"
Expand Down
8 changes: 4 additions & 4 deletions packages/ui/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
"date-fns": "^3.6.0",
"next-themes": "^0.3.0",
"react-day-picker": "^8.10.1",
"react-hook-form": "^7.51.1",
"react-hook-form": "^7.51.4",
"sonner": "^1.4.41",
"tailwind-merge": "^2.2.2",
"tailwindcss-animate": "^1.0.7"
Expand All @@ -40,13 +40,13 @@
"@acme/prettier-config": "workspace:*",
"@acme/tailwind-config": "workspace:*",
"@acme/tsconfig": "workspace:*",
"@types/react": "^18.3.1",
"eslint": "^9.1.1",
"@types/react": "^18.3.2",
"eslint": "^9.2.0",
"prettier": "^3.2.5",
"react": "18.3.1",
"tailwindcss": "^3.4.3",
"typescript": "^5.4.5",
"zod": "^3.23.4"
"zod": "^3.23.8"
},
"peerDependencies": {
"react": "18.2.0",
Expand Down
4 changes: 2 additions & 2 deletions packages/validators/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,13 @@
"typecheck": "tsc --noEmit --emitDeclarationOnly false"
},
"dependencies": {
"zod": "^3.23.4"
"zod": "^3.23.8"
},
"devDependencies": {
"@acme/eslint-config": "workspace:*",
"@acme/prettier-config": "workspace:*",
"@acme/tsconfig": "workspace:*",
"eslint": "^9.1.1",
"eslint": "^9.2.0",
"prettier": "^3.2.5",
"typescript": "^5.4.5"
},
Expand Down
Loading

0 comments on commit c878ff3

Please sign in to comment.