Skip to content

Commit

Permalink
update project structure
Browse files Browse the repository at this point in the history
  • Loading branch information
SMNBLMRR committed Jan 22, 2024
1 parent 33616cb commit 75e49e2
Show file tree
Hide file tree
Showing 8 changed files with 10 additions and 15 deletions.
2 changes: 1 addition & 1 deletion src/actions/todo.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import {
addGoalTodoService,
handleDeleteGoalByIdService,
} from "@/app/services/todo";
} from "@/services/todo";
import { InvalidAddTodoGoalException } from "@/exceptions/error";
import { log } from "@/lib/log";
import { validateAddTodoGoal } from "@/schema/todo";
Expand Down
11 changes: 3 additions & 8 deletions src/app/(protected)/app/goals/(ui)/goals-component.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,7 @@ import {
Input,
} from "@nextui-org/react";
import { Todo } from "@prisma/client";
import { FunctionComponent, useState, useTransition } from "react";

import { TiDeleteOutline } from "react-icons/ti";
import { FunctionComponent, useTransition } from "react";
import { RiMoreFill } from "react-icons/ri";

interface GoalsProps {
Expand All @@ -22,7 +20,6 @@ interface GoalsProps {

const Goals: FunctionComponent<GoalsProps> = ({ goals }) => {
const [, startTransition] = useTransition();
const [starColor, setStarColor] = useState(false);
const handleDeleteGoalFn = async (id: string) => {
startTransition(async () => {
await handleDeleteGoalAction(id);
Expand Down Expand Up @@ -80,10 +77,8 @@ const Goals: FunctionComponent<GoalsProps> = ({ goals }) => {
</div>
{/* actions section */}
<div className="ml-2 flex items-center justify-center ">

<div className="flex flex-col w-fit">
<span>created At</span>

</div>

<Dropdown>
Expand All @@ -108,8 +103,8 @@ const Goals: FunctionComponent<GoalsProps> = ({ goals }) => {
Create a copy
</DropdownItem>
<DropdownItem
color="danger"
variant="flat"
color="danger"
variant="flat"
key="delete"
shortcut="⌘D"
onClick={() => handleDeleteGoalFn(goal.id)}
Expand Down
6 changes: 3 additions & 3 deletions src/app/(protected)/app/goals/page.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { UserNotFoundException } from "@/exceptions/error";
import authOptions from "@/lib/authOptions";
import { getGoalsFromTodo, getTodoList } from "@/lib/todo";
import { getGoalsFromTodo, getTodoList } from "@/queries/todo";
import { Chip, Divider, Spinner } from "@nextui-org/react";
import { getServerSession } from "next-auth";
import { FunctionComponent, Suspense } from "react";
Expand Down Expand Up @@ -48,8 +48,8 @@ const Today: FunctionComponent<TodayProps> = async () => {
<HeaderTodo />
{Array.isArray(goals) && goals?.length > 0 ? (
<Divider orientation="horizontal" />
): null}
<Suspense fallback={<Spinner color="secondary"/>}>
) : null}
<Suspense fallback={<Spinner color="secondary" />}>
<Goals goals={goals} />
</Suspense>
</div>
Expand Down
2 changes: 1 addition & 1 deletion src/app/(protected)/app/layout.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { FunctionComponent } from "react";

import authOptions from "@/lib/authOptions";
import { getUserInfo } from "@/lib/user";
import { getUserInfo } from "@/queries/user";
import { getServerSession } from "next-auth";
import Info from "./(ui)/info-component";

Expand Down
2 changes: 1 addition & 1 deletion src/middleware.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,5 +48,5 @@ export default withAuth(
);

export const config = {
matcher: ["/app", "/api/:path*"],
matcher: ["/app","/app/*", "/api/:path*"],
};
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion src/app/services/todo.ts → src/services/todo.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import {
UserNotFoundException,
} from "@/exceptions/error";
import authOptions from "@/lib/authOptions";
import { addTodoGoal, deleteTodoGoal, getTodoList } from "@/lib/todo";
import { addTodoGoal, deleteTodoGoal, getTodoList } from "@/queries/todo";
import { GoalPayload } from "@/types/todo";
import { getServerSession } from "next-auth";

Expand Down

0 comments on commit 75e49e2

Please sign in to comment.