Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

consistent directory structure #111

Merged
merged 3 commits into from
Mar 4, 2024
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
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"db:push": "prisma db push",
"db:studio": "prisma studio",
"dev": "next dev",
"generate:svg": "npx @svgr/cli --no-index --out-dir src/app/_svg -- src/svg",
"generate:svg": "npx @svgr/cli --no-index --out-dir src/app/components/svg -- src/svg",
"postinstall": "prisma generate",
"lint": "next lint",
"start": "next start"
Expand Down
4 changes: 2 additions & 2 deletions src/app/(auth)/sign-in/page.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { type Metadata } from 'next'
import { getProviders } from 'next-auth/react'
import { redirect } from 'next/navigation'
import Logo from '~/app/_svg/logo'
import Logo from '~/components/svg/logo'
import { getServerAuthSession } from '~/server/auth'
import { SignInButtons } from './_components/sign-in-buttons'
import { SignInButtons } from '~/components/sign-in-buttons'

export const metadata: Metadata = {
title: 'Sign In - Beam',
Expand Down
4 changes: 2 additions & 2 deletions src/app/(default)/layout.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { type ReactNode } from 'react'
import { Header } from '../_components/header'
import { Footer } from '../_components/footer'
import { Header } from '~/components/header'
import { Footer } from '~/components/footer'

export default async function DefaultLayout({
children,
Expand Down
2 changes: 1 addition & 1 deletion src/app/(default)/new/page.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { type Metadata } from 'next'
import { PostForm } from './_components/post-form'
import { PostForm } from '~/components/post-form'

export const metadata = {
title: 'New Post - Beam',
Expand Down
2 changes: 1 addition & 1 deletion src/app/(default)/page.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { api } from '~/trpc/server'
import { PostFeed } from '../_components/post-feed'
import { PostFeed } from '~/components/post-feed'

const POSTS_PER_PAGE = 20

Expand Down
2 changes: 1 addition & 1 deletion src/app/(default)/post/[id]/edit/page.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { getServerAuthSession } from '~/server/auth'
import { api } from '~/trpc/server'

import { EditPostForm } from '../_components/edit-post-form'
import { EditPostForm } from '~/components/edit-post-form'

type ProfilePageParams = {
params: {
Expand Down
6 changes: 3 additions & 3 deletions src/app/(default)/post/[id]/page.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import { Avatar } from '~/app/_components/avatar'
import { Avatar } from '~/components/avatar'

import { Comment, AddCommentForm } from '~/app/_components/comment'
import { Comment, AddCommentForm } from '~/components/comment'

import { getServerAuthSession } from '~/server/auth'
import { api } from '~/trpc/server'
import { PostView } from '~/app/_components/post-view'
import { PostView } from '~/components/post-view'

type PostPageParams = {
params: {
Expand Down
6 changes: 3 additions & 3 deletions src/app/(default)/profile/[userId]/page.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import DotPattern from '~/app/_svg/dot-pattern'
import DotPattern from '~/components/svg/dot-pattern'

import { getServerAuthSession } from '~/server/auth'
import { api } from '~/trpc/server'
import { EditProfileAction } from './_components/edit-profile'
import { PostFeed } from '~/app/_components/post-feed'
import { EditProfileAction } from '~/components/edit-profile'
import { PostFeed } from '~/components/post-feed'
import { Suspense } from 'react'

type ProfilePageParams = {
Expand Down
10 changes: 5 additions & 5 deletions src/app/layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@ import { cookies } from 'next/headers'

import { TRPCReactProvider } from '~/trpc/react'
import { classNames } from '~/utils/core'
import { ThemeProvider } from '~/app/_providers/theme'
import { Toaster } from '~/app/_providers/toaster'
import { ThemeProvider } from '~/providers/theme'
import { Toaster } from '~/providers/toaster'

import { SearchDialog } from './_components/search-dialog'
import { AlertDialog } from './_components/alert-dialog'
import { SearchDialog } from '~/components/search-dialog'
import { AlertDialog } from '~/components/alert-dialog'
import { getServerAuthSession } from '~/server/auth'
import { SessionProvider } from './_providers/auth'
import { SessionProvider } from '~/providers/auth'

const inter = localFont({
variable: '--font-sans',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
import { type Session } from 'next-auth'
import { Button } from './button'
import { ProfileMenu } from './profile-menu'
import { useSearchStore } from '~/app/_hooks/use-search-store'
import SearchIcon from '../_svg/search-icon'
import { useSearchStore } from '~/hooks/use-search-store'
import SearchIcon from '~/components/svg/search-icon'

export const Actions = ({ session }: { session: Session | null }) => {
const { toggleOpen } = useSearchStore()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

import * as AlertDialogPrimitive from '@radix-ui/react-alert-dialog'
import * as React from 'react'
import XIcon from '../_svg/x-icon'
import { useDialogStore } from '../_hooks/use-dialog-store'
import XIcon from '~/components/svg/x-icon'
import { useDialogStore } from '~/hooks/use-dialog-store'
import { type ReactNode } from 'react'
import { classNames } from '~/utils/core'

Expand Down
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import { cva, type VariantProps } from 'class-variance-authority'
import Link, { type LinkProps } from 'next/link'

import { classNames } from '~/utils/core'
import Spinner from '../_svg/spinner'
import Spinner from '~/components/svg/spinner'

const button = cva(
'inline-flex items-center justify-center font-semibold transition-colors rounded-full focus-ring px-4 text-sm h-8',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import {
MenuItem,
MenuItemsContent,
} from './menu'
import DotsIcon from '../_svg/dots-icon'
import DotsIcon from '~/components/svg/dots-icon'
import { Button } from './button'
import { HtmlView } from './html-view'
import { api } from '~/trpc/react'
Expand All @@ -22,7 +22,7 @@ import { toast } from 'react-hot-toast'
import { Controller, type SubmitHandler, useForm } from 'react-hook-form'
import { MarkdownEditor } from './markdown-editor'

import { useDialogStore } from '../_hooks/use-dialog-store'
import { useDialogStore } from '~/hooks/use-dialog-store'
import {
AlertDialogAction,
AlertDialogActions,
Expand Down
4 changes: 2 additions & 2 deletions src/app/_components/dialog.tsx → src/components/dialog.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

import * as DialogPrimitive from '@radix-ui/react-dialog'
import * as React from 'react'
import XIcon from '../_svg/x-icon'
import { useDialogStore } from '../_hooks/use-dialog-store'
import XIcon from '~/components/svg/x-icon'
import { useDialogStore } from '~/hooks/use-dialog-store'
import { type ReactNode } from 'react'
import { classNames } from '~/utils/core'

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@

import * as React from 'react'
import { Controller, useForm } from 'react-hook-form'
import { TextField } from '~/app/_components/text-field'
import { Button } from '~/app/_components/button'
import MarkdownIcon from '~/app/_svg/markdown-icon'
import { MarkdownEditor } from '~/app/_components/markdown-editor'
import { TextField } from '~/components/text-field'
import { Button } from '~/components/button'
import MarkdownIcon from '~/components/svg/markdown-icon'
import { MarkdownEditor } from '~/components/markdown-editor'

import { api } from '~/trpc/react'
import { useRouter } from 'next/navigation'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,23 +2,23 @@

import { type SubmitHandler, useForm } from 'react-hook-form'
import { toast } from 'react-hot-toast'
import { Button } from '~/app/_components/button'
import { Button } from '~/components/button'
import {
AlertDialogContent,
AlertDialogTitle,
AlertDialogActions,
AlertDialogCloseButton,
AlertDialogAction,
AlertDialogCancel,
} from '~/app/_components/alert-dialog'
import { TextField } from '~/app/_components/text-field'
import { useDialogStore } from '~/app/_hooks/use-dialog-store'
import EditIcon from '~/app/_svg/edit-icon'
} from '~/components/alert-dialog'
import { TextField } from '~/components/text-field'
import { useDialogStore } from '~/hooks/use-dialog-store'
import EditIcon from '~/components/svg/edit-icon'
import { api } from '~/trpc/react'
import { type RouterOutputs } from '~/trpc/shared'
import { env } from '~/env'
import { UpdateAvatarAction } from './update-avatar'
import { Avatar } from '~/app/_components/avatar'
import { Avatar } from '~/components/avatar'

type EditFormData = {
name: string
Expand Down
4 changes: 2 additions & 2 deletions src/app/_components/footer.tsx → src/components/footer.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import GithubLogo from '../_svg/github-logo'
import HeartFilledIcon from '../_svg/heart-filled-icon'
import GithubLogo from '~/components/svg/github-logo'
import HeartFilledIcon from '~/components/svg/heart-filled-icon'

export const Footer = () => {
return (
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import Link from 'next/link'
import Logo from '../_svg/logo'
import Logo from '~/components/svg/logo'
import { getServerAuthSession } from '~/server/auth'

import { Actions } from './actions'
Expand Down
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,11 @@ import TextareaMarkdown, {
type TextareaMarkdownRef,
} from 'textarea-markdown-editor'

import BoldIcon from '../_svg/bold-icon'
import BoldIcon from '~/components/svg/bold-icon'
import { classNames } from '~/utils/core'
import ItalicIcon from '../_svg/italic-icon'
import LinkIcon from '../_svg/link-icon'
import ListIcon from '../_svg/list-icon'
import ItalicIcon from '~/components/svg/italic-icon'
import LinkIcon from '~/components/svg/link-icon'
import ListIcon from '~/components/svg/list-icon'
import { HtmlView } from './html-view'
import { type SuggestionType, getSuggestionData } from '~/utils/suggestion'
import { env } from '~/env'
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

import { usePathname } from 'next/navigation'
import { Button } from './button'
import ChevronLeftIcon from '../_svg/chevron-left-icon'
import ChevronRightIcon from '../_svg/chevron-right-icon'
import ChevronLeftIcon from '~/components/svg/chevron-left-icon'
import ChevronRightIcon from '~/components/svg/chevron-right-icon'

type PaginationProps = {
itemCount: number
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import { useRouter } from 'next/navigation'
import { toast } from 'react-hot-toast'
import { Button } from '~/app/_components/button'
import { Button } from '~/components/button'
import {
AlertDialogAction,
AlertDialogActions,
Expand All @@ -11,7 +11,7 @@ import {
AlertDialogDescription,
AlertDialogTitle,
AlertDialogCancel,
} from '~/app/_components/alert-dialog'
} from '~/components/alert-dialog'
import {
Menu,
MenuButton,
Expand All @@ -20,12 +20,12 @@ import {
MenuItem,
MenuItemsContent,
MenuItemLink,
} from '~/app/_components/menu'
import { useDialogStore } from '~/app/_hooks/use-dialog-store'
import DotsIcon from '~/app/_svg/dots-icon'
import EditIcon from '~/app/_svg/edit-icon'
import EyeIcon from '~/app/_svg/eye-icon'
import TrashIcon from '~/app/_svg/trash-icon'
} from '~/components/menu'
import { useDialogStore } from '~/hooks/use-dialog-store'
import DotsIcon from '~/components/svg/dots-icon'
import EditIcon from '~/components/svg/edit-icon'
import EyeIcon from '~/components/svg/eye-icon'
import TrashIcon from '~/components/svg/trash-icon'
import { api } from '~/trpc/react'

type PostActionProps = {
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@

import * as React from 'react'
import { Controller, useForm } from 'react-hook-form'
import { TextField } from '~/app/_components/text-field'
import { Button } from '~/app/_components/button'
import MarkdownIcon from '~/app/_svg/markdown-icon'
import { MarkdownEditor } from '~/app/_components/markdown-editor'
import { TextField } from '~/components/text-field'
import { Button } from '~/components/button'
import MarkdownIcon from '~/components/svg/markdown-icon'
import { MarkdownEditor } from '~/components/markdown-editor'
import { useRouter } from 'next/navigation'
import { api } from '~/trpc/react'

Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import Link from 'next/link'
import { summarize } from '~/server/summary'
import { type RouterOutputs } from '~/trpc/shared'
import { Banner } from '~/app/_components/banner'
import { Banner } from '~/components/banner'
import { classNames } from '~/utils/core'
import { formatDistanceToNow } from 'date-fns/formatDistanceToNow'
import { AuthorWithDate } from '~/app/_components/author-with-date'
import { HtmlView } from '~/app/_components/html-view'
import ChevronRightIcon from '~/app/_svg/chevron-right-icon'
import MessageIcon from '~/app/_svg/message-icon'
import { AuthorWithDate } from '~/components/author-with-date'
import { HtmlView } from '~/components/html-view'
import ChevronRightIcon from '~/components/svg/chevron-right-icon'
import MessageIcon from '~/components/svg/message-icon'

import { ReactionButton } from './reaction-button'
import { Suspense } from 'react'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@ import { api } from '~/trpc/react'
import { type RouterOutputs } from '~/trpc/shared'
import { Banner } from './banner'
import { useSession } from 'next-auth/react'
import { PostAction } from '../(default)/post/[id]/_components/post-action'
import { PostAction } from '~/components/post-action'
import { AuthorWithDate } from './author-with-date'
import { HtmlView } from './html-view'
import { ReactionButton } from './reaction-button'
import { Button } from './button'
import MessageIcon from '../_svg/message-icon'
import MessageIcon from '~/components/svg/message-icon'
import { Suspense } from 'react'

type PostViewProps = {
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

import { classNames } from '~/utils/core'
import { Button } from './button'
import HeartFilledIcon from '../_svg/heart-filled-icon'
import HeartIcon from '../_svg/heart-icon'
import HeartFilledIcon from '~/components/svg/heart-filled-icon'
import HeartIcon from '~/components/svg/heart-icon'

import { api } from '~/trpc/react'
import { useState } from 'react'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ import { useHotkeys } from 'react-hotkeys-hook'
import { useRouter } from 'next/navigation'
import { useDebounce } from 'use-debounce'
import { api } from '~/trpc/react'
import SearchIcon from '../_svg/search-icon'
import SpinnerIcon from '../_svg/spinner'
import { useSearchStore } from '~/app/_hooks/use-search-store'
import SearchIcon from '~/components/svg/search-icon'
import SpinnerIcon from '~/components/svg/spinner'
import { useSearchStore } from '~/hooks/use-search-store'

export const SearchDialog = () => {
const { open, toggleOpen } = useSearchStore()
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
'use client'
import { type getProviders, signIn } from 'next-auth/react'
import { Button } from '~/app/_components/button'
import { Button } from '~/components/button'

export const SignInButtons = ({
providers,
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@ import {
AlertDialogCloseButton,
AlertDialogContent,
AlertDialogTitle,
} from '~/app/_components/alert-dialog'
import { Avatar } from '~/app/_components/avatar'
import { Button } from '~/app/_components/button'
import { useDialogStore } from '~/app/_hooks/use-dialog-store'
import EditIcon from '~/app/_svg/edit-icon'
} from '~/components/alert-dialog'
import { Avatar } from '~/components/avatar'
import { Button } from '~/components/button'
import { useDialogStore } from '~/hooks/use-dialog-store'
import EditIcon from '~/components/svg/edit-icon'
import { uploadImage } from '~/server/cloudinary'
import { api } from '~/trpc/react'

Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Loading