Skip to content

Commit

Permalink
Move lib out of app directory
Browse files Browse the repository at this point in the history
  • Loading branch information
pahans committed May 20, 2024
1 parent 8a02239 commit b75dba6
Show file tree
Hide file tree
Showing 17 changed files with 15 additions and 15 deletions.
2 changes: 1 addition & 1 deletion src/app/[slug]/(read)/page.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { fetchPost } from "@/app/lib/data";
import { fetchPost } from "@/lib/data";
import { ReadPost, ReadPostSkeleton } from "@/components/app/read-post";
import { notFound } from "next/navigation";
import { Suspense } from "react";
Expand Down
2 changes: 1 addition & 1 deletion src/app/admin/page.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { EditPost } from "@/components/app/edit-post";
import { fetchPost } from "@/app/lib/data";
import { fetchPost } from "@/lib/data";
import { PostsTable } from "@/components/app/posts-table";
import { Suspense } from "react";
import { PostsTableSkeleton } from "@/components/app/posts-table/skeleton";
Expand Down
2 changes: 1 addition & 1 deletion src/app/layout.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { cn } from "@/lib/utils";
import type { Metadata } from "next";
import { Header } from "@/components/app/header";
import { ThemeProvider } from "@/components/app/theme-provider";
import { ThemeProvider } from "@/components/ui/theme-provider";
import { fontSans } from "./fonts";
import "./globals.css";

Expand Down
4 changes: 2 additions & 2 deletions src/components/app/edit-post/edit-post.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
"use client";
import { createOrUpdatePost } from "@/app/lib/actions";
import { BlogPost } from "@/app/lib/definitions";
import { createOrUpdatePost } from "@/lib/actions";
import { BlogPost } from "@/lib/definitions";
import { Button } from "@/components/ui/button";
import {
Dialog,
Expand Down
4 changes: 2 additions & 2 deletions src/components/app/posts-list/posts-list.test.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { render, screen } from "@testing-library/react";
import { PostsList } from ".";
import { BlogPost } from "@/app/lib/definitions";
import { BlogPost } from "@/lib/definitions";

const posts: BlogPost[] = [
{
Expand All @@ -17,7 +17,7 @@ const posts: BlogPost[] = [
},
];

jest.mock("@/app/lib/data", () => ({
jest.mock("@/lib/data", () => ({
fetchAllPosts: () => {
return Promise.resolve(posts);
},
Expand Down
2 changes: 1 addition & 1 deletion src/components/app/posts-list/posts-list.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Separator } from "@/components/ui/separator";
import { fetchAllPosts } from "@/app/lib/data";
import { fetchAllPosts } from "@/lib/data";
import Link from "next/link";

interface PostsListProps {}
Expand Down
4 changes: 2 additions & 2 deletions src/components/app/posts-table/actions-cell.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
import { Edit as EditIcon } from "lucide-react";
import { usePathname, useRouter } from "next/navigation";
import { Button } from "@/components/ui/button";
import { deletePost } from "@/app/lib/actions";
import { BlogPost } from "@/app/lib/definitions";
import { deletePost } from "@/lib/actions";
import { BlogPost } from "@/lib/definitions";
import { ConfirmDeleteDialog } from "./confirm-delete-dialog";
import { useCallback } from "react";

Expand Down
2 changes: 1 addition & 1 deletion src/components/app/posts-table/index.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { fetchAllPosts } from "@/app/lib/data";
import { fetchAllPosts } from "@/lib/data";
import { PostsTable as PostsTableClient } from "./posts-table";

export const PostsTable: React.FC = async () => {
Expand Down
2 changes: 1 addition & 1 deletion src/components/app/posts-table/posts-table.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
"use client";

import { ColumnDef } from "@tanstack/react-table";
import { BlogPost } from "@/app/lib/definitions";
import { BlogPost } from "@/lib/definitions";
import { DataTable } from "./data-table";
import { ActionsCell } from "./actions-cell";

Expand Down
2 changes: 1 addition & 1 deletion src/components/app/read-post/index.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { fetchPost } from "@/app/lib/data";
import { fetchPost } from "@/lib/data";
import { ReadPost as ReadPostClient } from "./read-post";
import { notFound } from "next/navigation";

Expand Down
2 changes: 1 addition & 1 deletion src/components/app/read-post/read-post.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
"use client";

import { BlogPost } from "@/app/lib/definitions";
import { BlogPost } from "@/lib/definitions";

interface ReadPostProps {
post: BlogPost;
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion src/app/lib/actions.ts → src/lib/actions.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
"use server";

import { db } from "@/app/lib/kysely";
import { db } from "@/lib/kysely";
import { z } from "zod";
import { redirect } from "next/navigation";
import { revalidatePath } from "next/cache";
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 comments on commit b75dba6

Please sign in to comment.