Compare commits

..

No commits in common. "ai-dev" and "master" have entirely different histories.

View File

@ -1,87 +1,166 @@
import React, { useEffect, useState } from 'react'; import React, { useEffect, useState } from 'react';
import type { ReactElement } from 'react'; import type { ReactElement } from 'react';
import Head from 'next/head'; import Head from 'next/head';
import Link from 'next/link'; import Link from 'next/link';
import axios from 'axios'; import BaseButton from '../components/BaseButton';
import CardBox from '../components/CardBox';
import SectionFullScreen from '../components/SectionFullScreen';
import LayoutGuest from '../layouts/Guest'; import LayoutGuest from '../layouts/Guest';
import BaseDivider from '../components/BaseDivider';
import BaseButtons from '../components/BaseButtons';
import { getPageTitle } from '../config'; import { getPageTitle } from '../config';
import { useAppSelector } from '../stores/hooks';
import CardBoxComponentTitle from "../components/CardBoxComponentTitle";
import { getPexelsImage, getPexelsVideo } from '../helpers/pexels';
export default function PortfolioLanding() {
const [profile, setProfile] = useState<any>(null);
const [projects, setProjects] = useState<any[]>([]);
const [skills, setSkills] = useState<any[]>([]);
useEffect(() => { export default function Starter() {
async function fetchData() { const [illustrationImage, setIllustrationImage] = useState({
try { src: undefined,
const [profileRes, projectsRes, skillsRes] = await Promise.all([ photographer: undefined,
axios.get('/personal_profiles'), photographer_url: undefined,
axios.get('/projects'), })
axios.get('/skills'), const [illustrationVideo, setIllustrationVideo] = useState({video_files: []})
]); const [contentType, setContentType] = useState('image');
setProfile(profileRes.data.rows[0] || {}); const [contentPosition, setContentPosition] = useState('background');
setProjects(projectsRes.data.rows || []); const textColor = useAppSelector((state) => state.style.linkColor);
setSkills(skillsRes.data.rows || []);
} catch (err) { const title = 'App Preview'
console.error('Error fetching data:', err);
} // Fetch Pexels image/video
} useEffect(() => {
fetchData(); async function fetchData() {
}, []); const image = await getPexelsImage();
const video = await getPexelsVideo();
setIllustrationImage(image);
setIllustrationVideo(video);
}
fetchData();
}, []);
const imageBlock = (image) => (
<div
className='hidden md:flex flex-col justify-end relative flex-grow-0 flex-shrink-0 w-1/3'
style={{
backgroundImage: `${
image
? `url(${image?.src?.original})`
: 'linear-gradient(rgba(255, 255, 255, 0.5), rgba(255, 255, 255, 0.5))'
}`,
backgroundSize: 'cover',
backgroundPosition: 'left center',
backgroundRepeat: 'no-repeat',
}}
>
<div className='flex justify-center w-full bg-blue-300/20'>
<a
className='text-[8px]'
href={image?.photographer_url}
target='_blank'
rel='noreferrer'
>
Photo by {image?.photographer} on Pexels
</a>
</div>
</div>
);
const videoBlock = (video) => {
if (video?.video_files?.length > 0) {
return (
<div className='hidden md:flex flex-col justify-end relative flex-grow-0 flex-shrink-0 w-1/3'>
<video
className='absolute top-0 left-0 w-full h-full object-cover'
autoPlay
loop
muted
>
<source src={video?.video_files[0]?.link} type='video/mp4'/>
Your browser does not support the video tag.
</video>
<div className='flex justify-center w-full bg-blue-300/20 z-10'>
<a
className='text-[8px]'
href={video?.user?.url}
target='_blank'
rel='noreferrer'
>
Video by {video.user.name} on Pexels
</a>
</div>
</div>)
}
};
return ( return (
<> <div
style={
contentPosition === 'background'
? {
backgroundImage: `${
illustrationImage
? `url(${illustrationImage.src?.original})`
: 'linear-gradient(rgba(255, 255, 255, 0.5), rgba(255, 255, 255, 0.5))'
}`,
backgroundSize: 'cover',
backgroundPosition: 'left center',
backgroundRepeat: 'no-repeat',
}
: {}
}
>
<Head> <Head>
<title>{getPageTitle('Portfolio')}</title> <title>{getPageTitle('Starter Page')}</title>
</Head> </Head>
<div className="min-h-screen bg-white text-slate-900 px-6 py-12 md:px-24"> <SectionFullScreen bg='violet'>
<header className="flex justify-between items-center mb-24"> <div
<h1 className="text-xl font-bold tracking-tighter">PORTFOLIO</h1> className={`flex ${
<nav> contentPosition === 'right' ? 'flex-row-reverse' : 'flex-row'
<Link href="/login" className="text-sm font-medium hover:text-blue-600 transition">Admin</Link> } min-h-screen w-full`}
</nav> >
</header> {contentType === 'image' && contentPosition !== 'background'
? imageBlock(illustrationImage)
: null}
{contentType === 'video' && contentPosition !== 'background'
? videoBlock(illustrationVideo)
: null}
<div className='flex items-center justify-center flex-col space-y-4 w-full lg:w-full'>
<CardBox className='w-full md:w-3/5 lg:w-2/3'>
<CardBoxComponentTitle title="Welcome to your App Preview app!"/>
<section className="mb-32"> <div className="space-y-3">
<h2 className="text-6xl md:text-8xl font-light tracking-tighter mb-6"> <p className='text-center '>This is a React.js/Node.js app generated by the <a className={`${textColor}`} href="https://flatlogic.com/generator">Flatlogic Web App Generator</a></p>
{profile?.name || 'Full Stack Developer'} <p className='text-center '>For guides and documentation please check
</h2> your local README.md and the <a className={`${textColor}`} href="https://flatlogic.com/documentation">Flatlogic documentation</a></p>
<p className="text-xl md:text-2xl text-slate-500 font-light max-w-2xl"> </div>
{profile?.bio || 'Building minimalist, modern, and elegant digital experiences.'}
</p>
</section>
<section className="mb-32"> <BaseButtons>
<h3 className="text-sm font-semibold tracking-widest uppercase mb-12 text-slate-400">Projects</h3> <BaseButton
<div className="grid grid-cols-1 md:grid-cols-2 gap-12"> href='/login'
{projects.map((project: any) => ( label='Login'
<div key={project.id} className="group cursor-pointer"> color='info'
<div className="aspect-video bg-slate-100 rounded-lg mb-6 overflow-hidden"> className='w-full'
<img src={project.image_url || '/placeholder.jpg'} alt={project.title} className="w-full h-full object-cover group-hover:scale-105 transition duration-500" /> />
</div>
<h4 className="text-2xl font-medium mb-2">{project.title}</h4>
<p className="text-slate-500">{project.description}</p>
</div>
))}
</div>
</section>
<section className="mb-32"> </BaseButtons>
<h3 className="text-sm font-semibold tracking-widest uppercase mb-12 text-slate-400">Core Skills</h3> </CardBox>
<div className="flex flex-wrap gap-4"> </div>
{skills.map((skill: any) => (
<span key={skill.id} className="px-4 py-2 border border-slate-200 rounded-full text-sm font-medium">
{skill.name}
</span>
))}
</div>
</section>
</div> </div>
</> </SectionFullScreen>
<div className='bg-black text-white flex flex-col text-center justify-center md:flex-row'>
<p className='py-6 text-sm'>© 2026 <span>{title}</span>. All rights reserved</p>
<Link className='py-6 ml-4 text-sm' href='/privacy-policy/'>
Privacy Policy
</Link>
</div>
</div>
); );
} }
PortfolioLanding.getLayout = function getLayout(page: ReactElement) { Starter.getLayout = function getLayout(page: ReactElement) {
return <LayoutGuest>{page}</LayoutGuest>; return <LayoutGuest>{page}</LayoutGuest>;
}; };