Skip to content

Commit

Permalink
refactor: ♻️ change path alias @ to ~
Browse files Browse the repository at this point in the history
  • Loading branch information
moinulmoin committed May 25, 2023
1 parent 8a0f143 commit a0595f7
Show file tree
Hide file tree
Showing 21 changed files with 531 additions and 556 deletions.
2 changes: 1 addition & 1 deletion src/app/api/auth/[...nextauth]/route.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { authOptions } from "@/lib/auth";
import NextAuth from "next-auth";
import { authOptions } from "~/lib/auth";

const handler = NextAuth(authOptions);

Expand Down
10 changes: 5 additions & 5 deletions src/app/layout.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import Footer from "@/components/layout/footer";
import Header from "@/components/layout/header";
import ThemeProvider from "@/components/shared/theme-provider";
import { Toaster } from "@/components/ui/toaster";
import { siteConfig } from "@/config/site";
import { Analytics } from "@vercel/analytics/react";
import { Metadata } from "next";
import { Inter } from "next/font/google";
import Footer from "~/components/layout/footer";
import Header from "~/components/layout/header";
import ThemeProvider from "~/components/shared/theme-provider";
import { Toaster } from "~/components/ui/toaster";
import { siteConfig } from "~/config/site";
import "./globals.css";

const inter = Inter({ subsets: ["latin"] });
Expand Down
4 changes: 2 additions & 2 deletions src/app/page.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import Icons from "@/components/shared/icons";
import { nFormatter } from "@/lib/utils";
import Balancer from "react-wrap-balancer";
import Icons from "~/components/shared/icons";
import { nFormatter } from "~/lib/utils";

export default async function Home() {
const { stargazers_count: stars } = await fetch(
Expand Down
2 changes: 1 addition & 1 deletion src/app/robots.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { siteConfig } from "@/config/site";
import { MetadataRoute } from "next";
import { siteConfig } from "~/config/site";

export default function robots(): MetadataRoute.Robots {
return {
Expand Down
2 changes: 1 addition & 1 deletion src/app/sitemap.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { siteConfig } from "@/config/site";
import { MetadataRoute } from "next";
import { siteConfig } from "~/config/site";

export default function sitemap(): MetadataRoute.Sitemap {
return [
Expand Down
2 changes: 1 addition & 1 deletion src/components/layout/footer.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { siteConfig } from "@/config/site";
import Image from "next/image";
import { siteConfig } from "~/config/site";

export default function Footer() {
return (
Expand Down
2 changes: 1 addition & 1 deletion src/components/layout/header/index.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { authOptions } from "@/lib/auth";
import { getServerSession } from "next-auth";
import { authOptions } from "~/lib/auth";
import Navbar from "./navbar";

async function Header() {
Expand Down
4 changes: 2 additions & 2 deletions src/components/layout/header/navbar.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
"use client";

import useScroll from "@/lib/hooks/use-scroll";
import { cn } from "@/lib/utils";
import { Session } from "next-auth";
import Image from "next/image";
import Link from "next/link";
import useScroll from "~/lib/hooks/use-scroll";
import { cn } from "~/lib/utils";
import ThemeToggle from "../../shared/theme-toggle";
import SignInModal from "../signin-modal";
import UserNav from "../user-nav";
Expand Down
10 changes: 5 additions & 5 deletions src/components/layout/signin-modal.tsx
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
"use client";

import { Button } from "@/components/ui/button";
import { signIn } from "next-auth/react";
import Image from "next/image";
import { useState } from "react";
import { Button } from "~/components/ui/button";
import {
Dialog,
DialogContent,
DialogHeader,
DialogTitle,
DialogTrigger,
} from "@/components/ui/dialog";
import { signIn } from "next-auth/react";
import Image from "next/image";
import { useState } from "react";
} from "~/components/ui/dialog";
import Icons from "../shared/icons";
import LoadingDots from "../shared/loading-dots";

Expand Down
12 changes: 6 additions & 6 deletions src/components/layout/user-nav.tsx
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
import { LogOut, User } from "lucide-react";

import { Avatar, AvatarFallback, AvatarImage } from "@/components/ui/avatar";
import { Button } from "@/components/ui/button";
import { Session } from "next-auth";
import { signOut } from "next-auth/react";
import Link from "next/link";
import { Avatar, AvatarFallback, AvatarImage } from "~/components/ui/avatar";
import { Button } from "~/components/ui/button";
import {
DropdownMenu,
DropdownMenuContent,
DropdownMenuItem,
DropdownMenuLabel,
DropdownMenuSeparator,
DropdownMenuTrigger,
} from "@/components/ui/dropdown-menu";
import { Session } from "next-auth";
import { signOut } from "next-auth/react";
import Link from "next/link";
} from "~/components/ui/dropdown-menu";

export default function UserNav({ session }: { session: Session | null }) {
return (
Expand Down
8 changes: 4 additions & 4 deletions src/components/shared/theme-toggle.tsx
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
"use client";

import Icons from "@/components/shared/icons";
import { Button } from "@/components/ui/button";
import { useTheme } from "next-themes";
import Icons from "~/components/shared/icons";
import { Button } from "~/components/ui/button";
import {
DropdownMenu,
DropdownMenuContent,
DropdownMenuItem,
DropdownMenuTrigger,
} from "@/components/ui/dropdown-menu";
import { useTheme } from "next-themes";
} from "~/components/ui/dropdown-menu";

export default function ThemeToggle() {
const { setTheme } = useTheme();
Expand Down
73 changes: 35 additions & 38 deletions src/components/ui/avatar.tsx
Original file line number Diff line number Diff line change
@@ -1,50 +1,47 @@
"use client"
"use client";

import * as React from "react"
import * as AvatarPrimitive from "@radix-ui/react-avatar"
import * as AvatarPrimitive from "@radix-ui/react-avatar";
import * as React from "react";

import { cn } from "@/lib/utils"
import { cn } from "~/lib/utils";

const Avatar = React.forwardRef<
React.ElementRef<typeof AvatarPrimitive.Root>,
React.ComponentPropsWithoutRef<typeof AvatarPrimitive.Root>
React.ElementRef<typeof AvatarPrimitive.Root>,
React.ComponentPropsWithoutRef<typeof AvatarPrimitive.Root>
>(({ className, ...props }, ref) => (
<AvatarPrimitive.Root
ref={ref}
className={cn(
"relative flex h-10 w-10 shrink-0 overflow-hidden rounded-full",
className
)}
{...props}
/>
))
Avatar.displayName = AvatarPrimitive.Root.displayName
<AvatarPrimitive.Root
ref={ref}
className={cn("relative flex h-10 w-10 shrink-0 overflow-hidden rounded-full", className)}
{...props}
/>
));
Avatar.displayName = AvatarPrimitive.Root.displayName;

const AvatarImage = React.forwardRef<
React.ElementRef<typeof AvatarPrimitive.Image>,
React.ComponentPropsWithoutRef<typeof AvatarPrimitive.Image>
React.ElementRef<typeof AvatarPrimitive.Image>,
React.ComponentPropsWithoutRef<typeof AvatarPrimitive.Image>
>(({ className, ...props }, ref) => (
<AvatarPrimitive.Image
ref={ref}
className={cn("aspect-square h-full w-full", className)}
{...props}
/>
))
AvatarImage.displayName = AvatarPrimitive.Image.displayName
<AvatarPrimitive.Image
ref={ref}
className={cn("aspect-square h-full w-full", className)}
{...props}
/>
));
AvatarImage.displayName = AvatarPrimitive.Image.displayName;

const AvatarFallback = React.forwardRef<
React.ElementRef<typeof AvatarPrimitive.Fallback>,
React.ComponentPropsWithoutRef<typeof AvatarPrimitive.Fallback>
React.ElementRef<typeof AvatarPrimitive.Fallback>,
React.ComponentPropsWithoutRef<typeof AvatarPrimitive.Fallback>
>(({ className, ...props }, ref) => (
<AvatarPrimitive.Fallback
ref={ref}
className={cn(
"flex h-full w-full items-center justify-center rounded-full bg-muted",
className
)}
{...props}
/>
))
AvatarFallback.displayName = AvatarPrimitive.Fallback.displayName
<AvatarPrimitive.Fallback
ref={ref}
className={cn(
"flex h-full w-full items-center justify-center rounded-full bg-muted",
className
)}
{...props}
/>
));
AvatarFallback.displayName = AvatarPrimitive.Fallback.displayName;

export { Avatar, AvatarImage, AvatarFallback }
export { Avatar, AvatarFallback, AvatarImage };
85 changes: 39 additions & 46 deletions src/components/ui/button.tsx
Original file line number Diff line number Diff line change
@@ -1,55 +1,48 @@
import * as React from "react"
import { Slot } from "@radix-ui/react-slot"
import { VariantProps, cva } from "class-variance-authority"
import { Slot } from "@radix-ui/react-slot";
import { VariantProps, cva } from "class-variance-authority";
import * as React from "react";

import { cn } from "@/lib/utils"
import { cn } from "~/lib/utils";

const buttonVariants = cva(
"inline-flex items-center justify-center rounded-md text-sm font-medium transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:opacity-50 disabled:pointer-events-none ring-offset-background",
{
variants: {
variant: {
default: "bg-primary text-primary-foreground hover:bg-primary/90",
destructive:
"bg-destructive text-destructive-foreground hover:bg-destructive/90",
outline:
"border border-input hover:bg-accent hover:text-accent-foreground",
secondary:
"bg-secondary text-secondary-foreground hover:bg-secondary/80",
ghost: "hover:bg-accent hover:text-accent-foreground",
link: "underline-offset-4 hover:underline text-primary",
},
size: {
default: "h-10 py-2 px-4",
sm: "h-9 px-3 rounded-md",
lg: "h-11 px-8 rounded-md",
},
},
defaultVariants: {
variant: "default",
size: "default",
},
}
)
"inline-flex items-center justify-center rounded-md text-sm font-medium transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:opacity-50 disabled:pointer-events-none ring-offset-background",
{
variants: {
variant: {
default: "bg-primary text-primary-foreground hover:bg-primary/90",
destructive: "bg-destructive text-destructive-foreground hover:bg-destructive/90",
outline: "border border-input hover:bg-accent hover:text-accent-foreground",
secondary: "bg-secondary text-secondary-foreground hover:bg-secondary/80",
ghost: "hover:bg-accent hover:text-accent-foreground",
link: "underline-offset-4 hover:underline text-primary",
},
size: {
default: "h-10 py-2 px-4",
sm: "h-9 px-3 rounded-md",
lg: "h-11 px-8 rounded-md",
},
},
defaultVariants: {
variant: "default",
size: "default",
},
}
);

export interface ButtonProps
extends React.ButtonHTMLAttributes<HTMLButtonElement>,
VariantProps<typeof buttonVariants> {
asChild?: boolean
extends React.ButtonHTMLAttributes<HTMLButtonElement>,
VariantProps<typeof buttonVariants> {
asChild?: boolean;
}

const Button = React.forwardRef<HTMLButtonElement, ButtonProps>(
({ className, variant, size, asChild = false, ...props }, ref) => {
const Comp = asChild ? Slot : "button"
return (
<Comp
className={cn(buttonVariants({ variant, size, className }))}
ref={ref}
{...props}
/>
)
}
)
Button.displayName = "Button"
({ className, variant, size, asChild = false, ...props }, ref) => {
const Comp = asChild ? Slot : "button";
return (
<Comp className={cn(buttonVariants({ variant, size, className }))} ref={ref} {...props} />
);
}
);
Button.displayName = "Button";

export { Button, buttonVariants }
export { Button, buttonVariants };
2 changes: 1 addition & 1 deletion src/components/ui/dialog.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import * as DialogPrimitive from "@radix-ui/react-dialog";
import { X } from "lucide-react";
import * as React from "react";

import { cn } from "@/lib/utils";
import { cn } from "~/lib/utils";

const Dialog = DialogPrimitive.Root;

Expand Down
Loading

1 comment on commit a0595f7

@vercel
Copy link

@vercel vercel bot commented on a0595f7 May 25, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.