Skip to content

Commit

Permalink
style(apps/web): use path alias
Browse files Browse the repository at this point in the history
  • Loading branch information
Mnigos committed Sep 29, 2024
1 parent 88cedf6 commit e9635a2
Show file tree
Hide file tree
Showing 15 changed files with 29 additions and 25 deletions.
4 changes: 2 additions & 2 deletions apps/web/app/@modal/(.)login/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ import { useTransition } from 'react'
import { useForm } from 'react-hook-form'
import { z } from 'zod'

import { login } from '../../actions/auth'
import { SubmitButton } from '../../components/submit-button'
import { login } from '~/server/actions/auth'
import { SubmitButton } from '~/components/submit-button'

const loginSchema = z.object({
name: z
Expand Down
6 changes: 3 additions & 3 deletions apps/web/app/thoughts/@modal/(..)thought/[id]/edit/page.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { EditThoughtDialog } from '../../../../../../components/thoughts'
import { getThoughtById } from '../../../../../../server/actions/thoughts'
import type { EditThoughtPageProps } from '../../../../../types/props'
import { EditThoughtDialog } from '~/components/thoughts'
import { getThoughtById } from '~/server/actions/thoughts'
import type { EditThoughtPageProps } from '~/app/types/props'

export default async function EditThoughtPage({
params,
Expand Down
5 changes: 3 additions & 2 deletions apps/web/app/thoughts/layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,10 @@ import {
import { LogOut, User } from 'lucide-react'
import type { ReactNode } from 'react'

import { getCurrentUser } from '../../server/actions/users'
import type { LayoutProps } from '../types/props'
import { logout } from '../../server/actions/auth'

import { getCurrentUser } from '~/server/actions/users'
import { logout } from '~/server/actions/auth'

export const runtime = 'edge'

Expand Down
6 changes: 3 additions & 3 deletions apps/web/app/thoughts/page.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { getThoughts } from '../../server/actions/thoughts'
import { getCurrentUser } from '../../server/actions/users'
import { ThoughtForm, ThoughtCard } from '../../components/thoughts'
import { getThoughts } from '~/server/actions/thoughts'
import { getCurrentUser } from '~/server/actions/users'
import { ThoughtForm, ThoughtCard } from '~/components/thoughts'

export default async function ThoughtsPage() {
const currentUser = await getCurrentUser()
Expand Down
2 changes: 1 addition & 1 deletion apps/web/components/thoughts/thought-card.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { Card, CardContent, CardHeader } from '@repo/ui/components/card'
import { Pencil, User } from 'lucide-react'
import Link from 'next/link'

import type { Thought } from '../../server/types/thoughts'
import type { Thought } from '~/server/types/thoughts'

namespace ThoughtCard {
export type Props = Readonly<
Expand Down
5 changes: 3 additions & 2 deletions apps/web/components/thoughts/thought-form.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,11 @@ import { useTransition } from 'react'
import { useForm } from 'react-hook-form'
import { z } from 'zod'

import { createThought, editThought } from '../../server/actions/thoughts'
import type { Thought } from '../../server/types/thoughts'
import { SubmitButton } from '../submit-button'

import { createThought, editThought } from '~/server/actions/thoughts'
import type { Thought } from '~/server/types/thoughts'

const thoughtSchema = z.object({
content: z
.string({
Expand Down
5 changes: 3 additions & 2 deletions apps/web/server/actions/auth.spec.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
import { mock } from 'vitest-mock-extended'
import { cookies } from 'next/headers'

import { trpc } from '../../lib/trpc'
import type { User } from '../types/users'

import { login, logout } from './auth'

import { trpc } from '~/lib/trpc'

vi.mock('next/headers')
vi.mock('../../lib/trpc', () => ({
vi.mock('~/lib/trpc', () => ({
trpc: {
user: {
login: {
Expand Down
2 changes: 1 addition & 1 deletion apps/web/server/actions/auth.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import { cookies } from 'next/headers'
import { redirect } from 'next/navigation'

import { trpc } from '../../lib/trpc'
import { trpc } from '~/lib/trpc'

export async function login(name: string) {
const user = await trpc.user.login.query({
Expand Down
2 changes: 1 addition & 1 deletion apps/web/server/actions/thoughts.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import {
} from './thoughts'
import { getCurrentUser } from './users'

vi.mock('../../lib/trpc', () => ({
vi.mock('~/lib/trpc', () => ({
trpc: {
thought: {
create: {
Expand Down
4 changes: 2 additions & 2 deletions apps/web/server/actions/thoughts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@

import { revalidateTag, unstable_cache } from 'next/cache'

import { trpc } from '../../lib/trpc'

import { getCurrentUser } from './users'

import { trpc } from '~/lib/trpc'

export const getThoughts = unstable_cache(() => trpc.thoughts.all.query(), [], {
tags: ['thoughts'],
revalidate: 60,
Expand Down
5 changes: 3 additions & 2 deletions apps/web/server/actions/users.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,13 @@ import { mock } from 'vitest-mock-extended'
import { cookies } from 'next/headers'
import type { MockInstance } from 'vitest'

import { trpc } from '../../lib/trpc'
import type { User } from '../types/users'

import { getCurrentUser } from './users'

vi.mock('../../lib/trpc', () => ({
import { trpc } from '~/lib/trpc'

vi.mock('~/lib/trpc', () => ({
trpc: {
user: {
byName: {
Expand Down
2 changes: 1 addition & 1 deletion apps/web/server/actions/users.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { unstable_cache } from 'next/cache'
import { redirect } from 'next/navigation'
import { cookies } from 'next/headers'

import { trpc } from '../../lib/trpc'
import { trpc } from '~/lib/trpc'

export async function getCurrentUser() {
const username = cookies().get('username')?.value
Expand Down
2 changes: 1 addition & 1 deletion apps/web/server/types/thoughts.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { trpc } from '../../lib/trpc'
import type { trpc } from '~/lib/trpc'

export type Thought = Awaited<
ReturnType<typeof trpc.thoughts.all.query>
Expand Down
2 changes: 1 addition & 1 deletion apps/web/server/types/users.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
import type { trpc } from '../../lib/trpc'
import type { trpc } from '~/lib/trpc'

export type User = Awaited<ReturnType<typeof trpc.user.byName.query>>
2 changes: 1 addition & 1 deletion packages/typescript-config/base.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,6 @@
"declaration": true,
"declarationMap": true,
"incremental": false,
"removeComments": true,
"removeComments": true
}
}

0 comments on commit e9635a2

Please sign in to comment.