Compare commits

...

1 Commits

Author SHA1 Message Date
Flatlogic Bot
07238e1544 PFOlio 2026-03-19 14:12:58 +00:00

View File

@ -1,166 +1,87 @@
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 BaseButton from '../components/BaseButton'; import axios from 'axios';
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[]>([]);
export default function Starter() { useEffect(() => {
const [illustrationImage, setIllustrationImage] = useState({ async function fetchData() {
src: undefined, try {
photographer: undefined, const [profileRes, projectsRes, skillsRes] = await Promise.all([
photographer_url: undefined, axios.get('/personal_profiles'),
}) axios.get('/projects'),
const [illustrationVideo, setIllustrationVideo] = useState({video_files: []}) axios.get('/skills'),
const [contentType, setContentType] = useState('image'); ]);
const [contentPosition, setContentPosition] = useState('background'); setProfile(profileRes.data.rows[0] || {});
const textColor = useAppSelector((state) => state.style.linkColor); setProjects(projectsRes.data.rows || []);
setSkills(skillsRes.data.rows || []);
const title = 'App Preview' } catch (err) {
console.error('Error fetching data:', err);
// Fetch Pexels image/video }
useEffect(() => { }
async function fetchData() { 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('Starter Page')}</title> <title>{getPageTitle('Portfolio')}</title>
</Head> </Head>
<SectionFullScreen bg='violet'> <div className="min-h-screen bg-white text-slate-900 px-6 py-12 md:px-24">
<div <header className="flex justify-between items-center mb-24">
className={`flex ${ <h1 className="text-xl font-bold tracking-tighter">PORTFOLIO</h1>
contentPosition === 'right' ? 'flex-row-reverse' : 'flex-row' <nav>
} min-h-screen w-full`} <Link href="/login" className="text-sm font-medium hover:text-blue-600 transition">Admin</Link>
> </nav>
{contentType === 'image' && contentPosition !== 'background' </header>
? 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!"/>
<div className="space-y-3">
<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>
<p className='text-center '>For guides and documentation please check
your local README.md and the <a className={`${textColor}`} href="https://flatlogic.com/documentation">Flatlogic documentation</a></p>
</div>
<BaseButtons>
<BaseButton
href='/login'
label='Login'
color='info'
className='w-full'
/>
</BaseButtons> <section className="mb-32">
</CardBox> <h2 className="text-6xl md:text-8xl font-light tracking-tighter mb-6">
</div> {profile?.name || 'Full Stack Developer'}
</div> </h2>
</SectionFullScreen> <p className="text-xl md:text-2xl text-slate-500 font-light max-w-2xl">
<div className='bg-black text-white flex flex-col text-center justify-center md:flex-row'> {profile?.bio || 'Building minimalist, modern, and elegant digital experiences.'}
<p className='py-6 text-sm'>© 2026 <span>{title}</span>. All rights reserved</p> </p>
<Link className='py-6 ml-4 text-sm' href='/privacy-policy/'> </section>
Privacy Policy
</Link>
</div>
</div> <section className="mb-32">
<h3 className="text-sm font-semibold tracking-widest uppercase mb-12 text-slate-400">Projects</h3>
<div className="grid grid-cols-1 md:grid-cols-2 gap-12">
{projects.map((project: any) => (
<div key={project.id} className="group cursor-pointer">
<div className="aspect-video bg-slate-100 rounded-lg mb-6 overflow-hidden">
<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">
<h3 className="text-sm font-semibold tracking-widest uppercase mb-12 text-slate-400">Core Skills</h3>
<div className="flex flex-wrap gap-4">
{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>
</>
); );
} }
Starter.getLayout = function getLayout(page: ReactElement) { PortfolioLanding.getLayout = function getLayout(page: ReactElement) {
return <LayoutGuest>{page}</LayoutGuest>; return <LayoutGuest>{page}</LayoutGuest>;
}; };