Skip to content

Commit df6d87b

Browse files
committed
Refactor project structure and update configuration files
1 parent 19d9818 commit df6d87b

18 files changed

+89
-60
lines changed

app/components/skeletons/country-list-skeleton.tsx

+2-2
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ const CountryListSkeleton = () => {
1212
{[...Array(12)].map((_, index) => (
1313
<div
1414
key={index}
15-
className="bg-gray-200 dark:bg-gray-700 space-y-7 rounded-lg shadow-sm animate-pulse p-5"
15+
className="bg-gray-200 min-h-[336px] max-h-[336px] dark:bg-gray-700 space-y-7 rounded-lg shadow-sm animate-pulse p-4"
1616
>
1717
<div className="bg-gray-300 dark:bg-gray-600 aspect-video rounded-lg animate-pulse"></div>
1818
<div>
@@ -21,7 +21,7 @@ const CountryListSkeleton = () => {
2121
{[...Array(3)].map((_, index) => (
2222
<div
2323
key={index}
24-
className="h-6 w-3/4 rounded-lg animate-pulse bg-gray-300 dark:bg-gray-600"
24+
className="h-5 w-3/4 rounded-lg animate-pulse bg-gray-300 dark:bg-gray-600"
2525
></div>
2626
))}
2727
</div>

app/components/user/add-to-favourites-form.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
"use client";
22
import { useOptimistic } from "react";
33
import AddToFavouritesButton from "./add-to-favourites-btn";
4-
import { addFavouriteCountryAction, removeFavouriteCountryAction } from "@/app/actions/actions";
4+
import { addFavouriteCountryAction, removeFavouriteCountryAction } from "@/server/actions/actions";
55

66
type Props = {
77
countryCode: string;

app/components/user/remove-from-favourites-form.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
"use client";
22
import { Country } from "@/app/_types/types";
3-
import { removeFavouriteCountryAction } from "@/app/actions/actions";
43
import { Button } from "@/components/ui/button";
4+
import { removeFavouriteCountryAction } from "@/server/actions/actions";
55
import { BookmarkIcon as BookmarkOutline } from "@heroicons/react/24/outline";
66
import { BookmarkIcon as BookmarkSolid } from "@heroicons/react/24/solid";
77
import { useState } from "react";

app/components/user/user-dropdown.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import Link from "next/link";
99
import { SignOutButton } from "../shared/sign-out-btn";
1010

1111
import UserButton from "./user-btn";
12-
import { getUser } from "@/lib/user";
12+
import { getUser } from "@/server/lib/user";
1313

1414
export default async function UserDropdown() {
1515
const user = await getUser();

app/countries-container.tsx

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
import { getCountries } from "@/lib/countries";
1+
import { getCountries } from "@/server/lib/countries";
22
import { alphabeticalOrder } from "@/utils/helpers";
33
import CountryList from "./components/country-list";
4-
import { getFavouriteCountries } from "@/lib/user";
4+
import { getFavouriteCountries } from "@/server/lib/user";
55
import { auth } from "@clerk/nextjs/server";
66

77
export default async function CountryContainer() {

app/country/[cca3]/country-details.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import Link from "next/link";
22
import { Button } from "@/components/ui/button";
3-
import { getCountry } from "@/lib/countries";
3+
import { getCountry } from "@/server/lib/countries";
44
import { FavouriteCountry } from "@prisma/client";
55
import { Country } from "@/app/_types/types";
66
import BackButton from "@/app/components/shared/back-btn";

app/favourite-countries/page.tsx

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
import { getCountry } from "@/lib/countries";
2-
import { getFavouriteCountries } from "@/lib/user";
1+
import { getCountry } from "@/server/lib/countries";
2+
import { getFavouriteCountries } from "@/server/lib/user";
33
import { auth } from "@clerk/nextjs/server";
44
import FavouriteCountriesContainer from "./favourite-countries-contrainer";
55

app/globals.css

+6-1
Original file line numberDiff line numberDiff line change
@@ -12,4 +12,9 @@ dd {
1212

1313
.cl-internal-1dauvpw {
1414
@apply hidden
15-
}
15+
}
16+
17+
@layer base {
18+
:root {
19+
20+
--radius: 0.5rem}}

components.json

+7-3
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,16 @@
66
"tailwind": {
77
"config": "tailwind.config.ts",
88
"css": "app/globals.css",
9-
"baseColor": "slate",
9+
"baseColor": "gray",
1010
"cssVariables": false,
1111
"prefix": ""
1212
},
1313
"aliases": {
1414
"components": "@/components",
15-
"utils": "@/lib/utils"
16-
}
15+
"utils": "@/lib/utils",
16+
"ui": "@/components/ui",
17+
"lib": "@/lib",
18+
"hooks": "@/hooks"
19+
},
20+
"iconLibrary": "lucide"
1721
}

components/ui/skeleton.tsx

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
import { cn } from "@/lib/utils"
2+
3+
function Skeleton({
4+
className,
5+
...props
6+
}: React.HTMLAttributes<HTMLDivElement>) {
7+
return (
8+
<div
9+
className={cn("animate-pulse rounded-md bg-gray-100 dark:bg-gray-800", className)}
10+
{...props}
11+
/>
12+
)
13+
}
14+
15+
export { Skeleton }

lib/utils.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { type ClassValue, clsx } from "clsx"
1+
import { clsx, type ClassValue } from "clsx"
22
import { twMerge } from "tailwind-merge"
33

44
export function cn(...inputs: ClassValue[]) {

package-lock.json

+10-19
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
"@radix-ui/react-dropdown-menu": "^2.1.1",
1717
"@radix-ui/react-select": "^2.1.1",
1818
"@radix-ui/react-slot": "^1.1.0",
19-
"class-variance-authority": "^0.7.0",
19+
"class-variance-authority": "^0.7.1",
2020
"clsx": "^2.1.1",
2121
"framer-motion": "^11.3.21",
2222
"lucide-react": "^0.424.0",
@@ -27,7 +27,7 @@
2727
"react": "^18",
2828
"react-dom": "^18",
2929
"sharp": "^0.33.5",
30-
"tailwind-merge": "^2.4.0",
30+
"tailwind-merge": "^2.6.0",
3131
"tailwindcss-animate": "^1.0.7"
3232
},
3333
"devDependencies": {

app/actions/actions.ts server/actions/actions.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
"use server";
2-
import { addFavouriteCountry, removeFavouriteCountry } from "@/lib/user";
2+
import { addFavouriteCountry, removeFavouriteCountry } from "@/server/lib/user";
33
import { revalidatePath } from "next/cache";
44

55
export async function addFavouriteCountryAction(countryCode: string) {
File renamed without changes.

lib/data.json server/lib/data.json

File renamed without changes.

lib/user.ts server/lib/user.ts

File renamed without changes.

tailwind.config.ts

+37-23
Original file line numberDiff line numberDiff line change
@@ -10,29 +10,43 @@ const config = {
1010
],
1111
prefix: "",
1212
theme: {
13-
container: {
14-
center: true,
15-
padding: "2rem",
16-
screens: {
17-
"2xl": "1400px",
18-
},
19-
},
20-
extend: {
21-
keyframes: {
22-
"accordion-down": {
23-
from: { height: "0" },
24-
to: { height: "var(--radix-accordion-content-height)" },
25-
},
26-
"accordion-up": {
27-
from: { height: "var(--radix-accordion-content-height)" },
28-
to: { height: "0" },
29-
},
30-
},
31-
animation: {
32-
"accordion-down": "accordion-down 0.2s ease-out",
33-
"accordion-up": "accordion-up 0.2s ease-out",
34-
},
35-
},
13+
container: {
14+
center: true,
15+
padding: '2rem',
16+
screens: {
17+
'2xl': '1400px'
18+
}
19+
},
20+
extend: {
21+
keyframes: {
22+
'accordion-down': {
23+
from: {
24+
height: '0'
25+
},
26+
to: {
27+
height: 'var(--radix-accordion-content-height)'
28+
}
29+
},
30+
'accordion-up': {
31+
from: {
32+
height: 'var(--radix-accordion-content-height)'
33+
},
34+
to: {
35+
height: '0'
36+
}
37+
}
38+
},
39+
animation: {
40+
'accordion-down': 'accordion-down 0.2s ease-out',
41+
'accordion-up': 'accordion-up 0.2s ease-out'
42+
},
43+
borderRadius: {
44+
lg: 'var(--radius)',
45+
md: 'calc(var(--radius) - 2px)',
46+
sm: 'calc(var(--radius) - 4px)'
47+
},
48+
colors: {}
49+
}
3650
},
3751
plugins: [require("tailwindcss-animate")],
3852
} satisfies Config

0 commit comments

Comments
 (0)