Skip to content

Commit

Permalink
Move data retrieval into data directory
Browse files Browse the repository at this point in the history
  • Loading branch information
salimi-my committed Jan 30, 2024
1 parent 67d39fe commit 7f0dd23
Show file tree
Hide file tree
Showing 13 changed files with 32 additions and 23 deletions.
2 changes: 1 addition & 1 deletion app/api/portfolio/route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { NextRequest, NextResponse } from 'next/server';

import prismadb from '@/lib/prismadb';
import { currentUser } from '@/lib/authentication';
import addBlurredDataUrls from '@/lib/get-blur-data';
import addBlurredDataUrls from '@/data/image-blur';

export async function POST(req: Request) {
try {
Expand Down
4 changes: 2 additions & 2 deletions app/page.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import getData from '@/actions/get-data';
import getInformation from '@/data/information';
import Nav from '@/components/landing/nav';
import Tool from '@/components/landing/tool';
import About from '@/components/landing/about';
Expand All @@ -24,7 +24,7 @@ export default async function Home() {
portfolioWithBlur,
miscellaneous,
tool
} = await getData();
} = await getInformation();

return (
<>
Expand Down
4 changes: 2 additions & 2 deletions components/landing/about.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { useRef } from 'react';
import { motion, useInView } from 'framer-motion';
import { Briefcase, FolderGit2, Laptop } from 'lucide-react';

import type getData from '@/actions/get-data';
import type getInformation from '@/data/information';
import { Button } from '@/components/ui/button';
import tilted from '@/public/web-developer-tilted.webp';
import {
Expand All @@ -15,7 +15,7 @@ import {
slideInFromTop
} from '@/lib/motion';

type AboutProps = Pick<Awaited<ReturnType<typeof getData>>, 'about'>;
type AboutProps = Pick<Awaited<ReturnType<typeof getInformation>>, 'about'>;

export default function About({ about }: AboutProps) {
const ref = useRef(null);
Expand Down
7 changes: 5 additions & 2 deletions components/landing/contact.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import Link from 'next/link';
import { useRef } from 'react';
import { motion, useInView } from 'framer-motion';

import type getData from '@/actions/get-data';
import type getInformation from '@/data/information';
import { Button } from '@/components/ui/button';
import { Icons } from '@/components/landing/icons';
import ContactForm from '@/components/landing/contact-form';
Expand All @@ -14,7 +14,10 @@ import {
slideInFromTop
} from '@/lib/motion';

type ContactProps = Pick<Awaited<ReturnType<typeof getData>>, 'miscellaneous'>;
type ContactProps = Pick<
Awaited<ReturnType<typeof getInformation>>,
'miscellaneous'
>;

export default function Contact({ miscellaneous }: ContactProps) {
const ref = useRef(null);
Expand Down
4 changes: 2 additions & 2 deletions components/landing/experience.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,15 @@ import { useRef } from 'react';
import { BadgeCheck } from 'lucide-react';
import { motion, useInView } from 'framer-motion';

import type getData from '@/actions/get-data';
import type getInformation from '@/data/information';
import {
slideInFromLeft,
slideInFromRight,
slideInFromTop
} from '@/lib/motion';

type ExperienceProps = Pick<
Awaited<ReturnType<typeof getData>>,
Awaited<ReturnType<typeof getInformation>>,
'frontend' | 'backend'
>;

Expand Down
4 changes: 2 additions & 2 deletions components/landing/expertise.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@ import { useRef } from 'react';
import { Check } from 'lucide-react';
import { motion, useInView } from 'framer-motion';

import type getData from '@/actions/get-data';
import type getInformation from '@/data/information';
import { slideInFromLeft, slideInFromTop } from '@/lib/motion';

type ExpertiseProps = Pick<
Awaited<ReturnType<typeof getData>>,
Awaited<ReturnType<typeof getInformation>>,
'seooptimization' | 'webdevelopment' | 'contentcreation'
>;

Expand Down
7 changes: 5 additions & 2 deletions components/landing/footer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,14 @@ import { useRef } from 'react';
import { motion, useInView } from 'framer-motion';
import { Facebook, Instagram, Linkedin, Twitter } from 'lucide-react';

import type getData from '@/actions/get-data';
import type getInformation from '@/data/information';
import { Button } from '@/components/ui/button';
import { slideInFromLeft, slideInFromRight } from '@/lib/motion';

type FooterProps = Pick<Awaited<ReturnType<typeof getData>>, 'miscellaneous'>;
type FooterProps = Pick<
Awaited<ReturnType<typeof getInformation>>,
'miscellaneous'
>;

export default function Footer({ miscellaneous }: FooterProps) {
const ref = useRef(null);
Expand Down
7 changes: 5 additions & 2 deletions components/landing/header.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,15 @@ import { motion } from 'framer-motion';
import { useTypewriter, Cursor } from 'react-simple-typewriter';
import { MessageCircle, Facebook, Linkedin, Github } from 'lucide-react';

import type getData from '@/actions/get-data';
import type getInformation from '@/data/information';
import { Button } from '@/components/ui/button';
import profile from '@/public/web-developer.webp';
import { slideInFromLeft, slideInFromRight } from '@/lib/motion';

type HeaderProps = Pick<Awaited<ReturnType<typeof getData>>, 'miscellaneous'>;
type HeaderProps = Pick<
Awaited<ReturnType<typeof getInformation>>,
'miscellaneous'
>;

export default function Header({ miscellaneous }: HeaderProps) {
const [text] = useTypewriter({
Expand Down
4 changes: 2 additions & 2 deletions components/landing/portfolio.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,14 @@ import { useRef, useState } from 'react';
import { CopyPlus, Loader2 } from 'lucide-react';
import { motion, useInView } from 'framer-motion';

import type getData from '@/actions/get-data';
import type getInformation from '@/data/information';
import { slideInFromTop } from '@/lib/motion';
import { Button } from '@/components/ui/button';
import { useToast } from '@/components/ui/use-toast';
import PortfolioCard from '@/components/landing/portfolio-card';

type PortfolioProps = Pick<
Awaited<ReturnType<typeof getData>>,
Awaited<ReturnType<typeof getInformation>>,
'portfolioWithBlur'
>;

Expand Down
4 changes: 2 additions & 2 deletions components/landing/qualification.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@ import { useRef } from 'react';
import { motion, useInView } from 'framer-motion';
import { Briefcase, GraduationCap } from 'lucide-react';

import type getData from '@/actions/get-data';
import type getInformation from '@/data/information';
import { slideInFromRight, slideInFromTop } from '@/lib/motion';
import QualificationCard from '@/components/landing/qualification-card';
import { Tabs, TabsContent, TabsList, TabsTrigger } from '@/components/ui/tabs';

type QualificationProps = Pick<
Awaited<ReturnType<typeof getData>>,
Awaited<ReturnType<typeof getInformation>>,
'education' | 'experience'
>;

Expand Down
4 changes: 2 additions & 2 deletions components/landing/tool.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ import Image from 'next/image';
import { motion, useInView } from 'framer-motion';

import { cn } from '@/lib/utils';
import type getData from '@/actions/get-data';
import type getInformation from '@/data/information';
import { slideInFromRight, slideInFromTop } from '@/lib/motion';

type ToolProps = Pick<Awaited<ReturnType<typeof getData>>, 'tool'>;
type ToolProps = Pick<Awaited<ReturnType<typeof getInformation>>, 'tool'>;

export default function Tool({ tool }: ToolProps) {
const ref = useRef(null);
Expand Down
File renamed without changes.
4 changes: 2 additions & 2 deletions actions/get-data.ts → data/information.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import prismadb from '@/lib/prismadb';
import addBlurredDataUrls from '@/lib/get-blur-data';
import addBlurredDataUrls from '@/data/image-blur';
import type {
About,
Experience,
Expand Down Expand Up @@ -35,7 +35,7 @@ interface Data {
tool: Tool[];
}

export default async function getData(): Promise<Data> {
export default async function getInformation(): Promise<Data> {
const [
about,
frontend,
Expand Down

0 comments on commit 7f0dd23

Please sign in to comment.