Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions apps/docs/app/page.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
import { Button, Header } from "ui"
import { Button } from "ui"

export default function Page() {
return (
<>
<Header text="Docs" />
<Button />
</>
)
Expand Down
7 changes: 4 additions & 3 deletions apps/web/src/actions/auth/index.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
"use server"

import bcryptjs from "bcryptjs"
import { signIn, signOut } from "configs/auth"
import { Prisma } from "database"
import { createUser } from "database/src/users/queries"
import { sendEmail } from "emails"
import VerifyEmail from "emails/verify-email"
import { redirect } from "utils/navigation"

import { signIn, signOut } from "@/configs/auth"
import { sendEmail } from "@/emails"
import { redirect } from "@/utils/navigation"

import { SignUpDataOutput, signUpSchema } from "./type"

Expand Down
9 changes: 5 additions & 4 deletions apps/web/src/actions/protect/postAction.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@
import { revalidatePath } from "next/cache"
import { redirect } from "next/navigation"

import { auth } from "configs/auth"
import APP_ROUTES from "constants/routes"
import prisma, {
createPost,
PostOnUserType,
Expand All @@ -15,11 +13,14 @@ import prisma, {
updatePost,
updatePostStatus,
} from "database"
import { ActionState, validatedActionWithUser } from "libs/validationAction"
import { toast } from "react-toastify"
import { TUserItem, userSelect } from "types/users"
import * as z from "zod"

import { auth } from "@/configs/auth"
import APP_ROUTES from "@/constants/routes"
import { ActionState, validatedActionWithUser } from "@/libs/validationAction"
import { TUserItem, userSelect } from "@/types/users"

export const getTotalActions = async ({
postId,
actionType,
Expand Down
5 changes: 3 additions & 2 deletions apps/web/src/app/[lang]/(auth)/signin/page.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
import React from "react"
import { redirect } from "next/navigation"

import { auth } from "configs/auth"
import SignIn from "molecules/auth/sign-in"
import { getTranslations } from "next-intl/server"

import { auth } from "@/configs/auth"
import SignIn from "@/molecules/auth/sign-in"

export async function generateMetadata() {
const t = await getTranslations()

Expand Down
2 changes: 1 addition & 1 deletion apps/web/src/app/[lang]/(auth)/signup/page.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React from "react"

import SignUp from "molecules/auth/sign-up"
import SignUp from "@/molecules/auth/sign-up"

const RegisterPage: React.FC = () => {
return (
Expand Down
2 changes: 1 addition & 1 deletion apps/web/src/app/[lang]/(protected)/layout.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import SidebarItem, { SidebarItemProps } from "molecules/sidebar-item"
import SidebarItem, { SidebarItemProps } from "@/molecules/sidebar-item"

const SIDE_BAR = [
{
Expand Down
7 changes: 4 additions & 3 deletions apps/web/src/app/[lang]/(protected)/user/posts/page.tsx
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
import React from "react"
import { Metadata } from "next/types"

import { auth } from "configs/auth"
import { getUser } from "database"
import PageTitle from "molecules/page-title"

import { auth } from "@/configs/auth"
import PageTitle from "@/molecules/page-title"

export async function generateMetadata(): Promise<Metadata> {
const session = await auth()
const user = await getUser({ userId: session?.user?.id })
const user = await getUser({ where: { id: session?.user?.id } })

return {
title: `Posts - ${user?.data?.name}`,
Expand Down
10 changes: 5 additions & 5 deletions apps/web/src/app/[lang]/(protected)/user/profile/page.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { auth } from "configs/auth"
import APP_APIS from "constants/apis"
import PageTitle from "molecules/page-title"
import Profile from "molecules/profile"
import { generatePath } from "utils/generatePath"
import { auth } from "@/configs/auth"
import APP_APIS from "@/constants/apis"
import PageTitle from "@/molecules/page-title"
import Profile from "@/molecules/profile"
import { generatePath } from "@/utils/generatePath"

export default async function Page() {
let currentUser = null
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import { Metadata } from "next"

import { getPost } from "database"
import PostForm from "molecules/post-form"

import PostForm from "@/molecules/post-form"

export async function generateMetadata(props): Promise<Metadata> {
const params = await props.params
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { redirect } from "next/navigation"

import { auth } from "configs/auth"
import APP_ROUTES from "constants/routes"
import PostForm from "molecules/post-form"
import { auth } from "@/configs/auth"
import APP_ROUTES from "@/constants/routes"
import PostForm from "@/molecules/post-form"

export const metadata = {
title: "Create Post",
Expand Down
4 changes: 2 additions & 2 deletions apps/web/src/app/[lang]/(public)/contact/page.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import ContactForm from "molecules/contact-form/contact-form"
import PageTitle from "molecules/page-title"
import ContactForm from "@/molecules/contact-form/contact-form"
import PageTitle from "@/molecules/page-title"

export default async function ContactUs() {
return (
Expand Down
7 changes: 4 additions & 3 deletions apps/web/src/app/[lang]/(public)/layout.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
import { BookCopy, HomeIcon, Smartphone, TagIcon } from "lucide-react"
import SidebarItem, { SidebarItemProps } from "molecules/sidebar-item"
import SquareAdvertisement from "molecules/square-advertisement"
import TopTag from "molecules/top-tags"
import { useTranslations } from "next-intl"

import SidebarItem, { SidebarItemProps } from "@/molecules/sidebar-item"
import SquareAdvertisement from "@/molecules/square-advertisement"
import TopTag from "@/molecules/top-tags"

export default function PublicLayout({ children }: { children: React.ReactNode }) {
const t = useTranslations("common")

Expand Down
5 changes: 3 additions & 2 deletions apps/web/src/app/[lang]/(public)/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,11 @@ import { Suspense } from "react"
import { Metadata } from "next"

import { PostStatus } from "database"
import Filter from "molecules/home/filter"
import PostList from "molecules/posts/post-list"
import { PostSkeleton } from "ui"

import Filter from "@/molecules/home/filter"
import PostList from "@/molecules/posts/post-list"

export const metadata: Metadata = {
title: "Next-forum - Share the best things",
description: "Share the best things in the world",
Expand Down
7 changes: 4 additions & 3 deletions apps/web/src/app/[lang]/(public)/search/page.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
import { Metadata } from "next"

import Filter from "molecules/home/filter"
import SearchBar from "molecules/nav/search-bar"
import PostList from "molecules/posts/post-list"
import { getTranslations } from "next-intl/server"
import { Typography } from "ui"

import Filter from "@/molecules/home/filter"
import SearchBar from "@/molecules/nav/search-bar"
import PostList from "@/molecules/posts/post-list"

export async function generateMetadata(props): Promise<Metadata> {
const searchParams = await props.searchParams
return {
Expand Down
6 changes: 3 additions & 3 deletions apps/web/src/app/[lang]/(public)/tags/page.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import PageTitle from "molecules/page-title"
import Filter from "molecules/tag/filter"
import TagList from "molecules/tag/tag-list"
import PageTitle from "@/molecules/page-title"
import Filter from "@/molecules/tag/filter"
import TagList from "@/molecules/tag/tag-list"

export const metadata = {
title: "Tags",
Expand Down
5 changes: 3 additions & 2 deletions apps/web/src/app/[lang]/(public)/ui/page.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
import { Metadata } from "next"

import { LucideHeart } from "lucide-react"
import PageTitle from "molecules/page-title"
import TagBadge from "molecules/tag/tag-badge"
import { Button, Input, Typography } from "ui"

import PageTitle from "@/molecules/page-title"
import TagBadge from "@/molecules/tag/tag-badge"

export const metadata: Metadata = {
title: "Next-forum - Page UI",
description: "UI components for pages",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
import { Metadata } from "next"

import APP_APIS from "constants/apis"
import Followers from "molecules/follower/followers"
import UserProfile from "molecules/follower/user-profile"
import { generatePath } from "utils/generatePath"

import APP_APIS from "@/constants/apis"
import Followers from "@/molecules/follower/followers"
import UserProfile from "@/molecules/follower/user-profile"
import { TUserItem } from "@/types/users"
import { generatePath } from "@/utils/generatePath"

export async function generateMetadata(props: {
params: Promise<{ authorId: string }>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { getUser } from "database"
import UserProfile from "molecules/follower/user-profile"
import PostList from "molecules/posts/post-list"

import UserProfile from "@/molecules/follower/user-profile"
import PostList from "@/molecules/posts/post-list"

export const generateMetadata = async (props) => {
const params = await props.params
Expand Down
Original file line number Diff line number Diff line change
@@ -1,17 +1,18 @@
import { Metadata } from "next"
import { notFound } from "next/navigation"

import PostDetail from "molecules/posts/post-detail"
import Comments from "molecules/posts/post-detail/comments"
import LikeButton from "molecules/posts/post-detail/like-button"
import TableOfContents from "molecules/posts/post-detail/table-of-contents"
import BookmarkButton from "molecules/posts/post-item/bookmark-button"
import PostDetail from "@/molecules/posts/post-detail"
import Comments from "@/molecules/posts/post-detail/comments"
import LikeButton from "@/molecules/posts/post-detail/like-button"
import TableOfContents from "@/molecules/posts/post-detail/table-of-contents"
import BookmarkButton from "@/molecules/posts/post-item/bookmark-button"

import "./tocbot.css"

import { auth } from "configs/auth"
import { getPost, PostStatus } from "database"
import { TSearchParams } from "types"

import { auth } from "@/configs/auth"
import { TSearchParams } from "@/types"

export async function generateMetadata(props): Promise<Metadata> {
const params = await props.params
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import TagDetail from "molecules/tag/tag-detail"

import { getTagById } from "@/actions/public/tags"
// import { getTagById } from "@/actions/public/tags"
import TagDetail from "@/molecules/tag/tag-detail"

export const metadata = {
title: "Tags",
Expand All @@ -9,11 +8,7 @@ export const metadata = {

export default async function Page(props: { params: Promise<{ tagId: string }> }) {
const params = await props.params
const tag = await getTagById(params?.tagId as string)
// const tag = await getTagById(params?.tagId as string)

return (
<div className="grid grid-cols-12 gap-10">
<TagDetail tag={tag} />
</div>
)
return <div className="grid grid-cols-12 gap-10">{/* <TagDetail tag={tag} /> */}</div>
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { getTag } from "database"
import PostList from "molecules/posts/post-list"
import TagDetail from "molecules/tag/tag-detail"

import PostList from "@/molecules/posts/post-list"
import TagDetail from "@/molecules/tag/tag-detail"

export const generateMetadata = async (props) => {
const params = await props.params
Expand Down
7 changes: 4 additions & 3 deletions apps/web/src/app/[lang]/layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,13 @@ import "./globals.css"
import "ui/dist/index.css"
import "react-toastify/dist/ReactToastify.css"

import Footer from "molecules/footer"
import Nav from "molecules/nav"
import { NextIntlClientProvider, useMessages } from "next-intl"
import { Providers } from "providers"
import { ToastContainer } from "react-toastify"

import Footer from "@/molecules/footer"
import Nav from "@/molecules/nav"
import { Providers } from "@/providers"

export const metadata = {
icons: {
icon: "/assets/logo.png",
Expand Down
2 changes: 1 addition & 1 deletion apps/web/src/app/api/auth/[...nextauth]/route.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
import { GET, POST } from "configs/auth"
import { GET, POST } from "@/configs/auth"

export { GET, POST }
2 changes: 1 addition & 1 deletion apps/web/src/app/api/protected/comment/route.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { NextRequest } from "next/server"

import { auth } from "configs/auth"
import prisma from "database"
import { z } from "zod"

import { auth } from "@/configs/auth"
import { commentSelect } from "@/types/comment"

export async function POST(request: NextRequest) {
Expand Down
19 changes: 12 additions & 7 deletions apps/web/src/app/api/protected/images/route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,13 @@ import fs from "fs/promises"
import path from "path"
import { NextRequest } from "next/server"

import { auth } from "configs/auth"
import { OrderByField } from "constants/upload"
import { createImage, getImage, getImages, IImageFilter, ImageOrderBys, OrderBy } from "database"
import { createImage, getImage, getImages, IImageFilter, ImageOrderBys } from "database"
import sharp from "sharp"
import { v4 as uuidv4 } from "uuid"

import { auth } from "@/configs/auth"
import { OrderByField } from "@/constants/upload"

const OrderMap = {
[OrderByField.nameAsc]: {
order: "asc",
Expand Down Expand Up @@ -37,9 +38,9 @@ export async function GET(request: NextRequest) {
const params: IImageFilter = {
page,
limit,
search,
orderBy: OrderMap[order].orderBy as ImageOrderBys,
order: OrderMap[order].order as OrderBy,
// search,
// orderBy: OrderMap[order].orderBy as ImageOrderBys,
// order: OrderMap[order].order as OrderBy,
}

try {
Expand Down Expand Up @@ -155,7 +156,11 @@ export async function POST(request: NextRequest) {
caption: "",
url: urls[0],
mime: file.type,
userId: session.user.id,
user: {
connect: {
id: session.user.id,
},
},
})

return Response.json({
Expand Down
2 changes: 1 addition & 1 deletion apps/web/src/app/api/protected/tags/route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ export async function GET(request: NextRequest) {
const search = newUrl.searchParams.get("search") || ""

try {
const posts = await prisma.tags.findMany({
const posts = await prisma.tag.findMany({
where: {
name: {
contains: search,
Expand Down
Loading
Loading