impostata struttura di magricambi

This commit is contained in:
AV77web 2026-05-25 15:13:52 +02:00
parent ad52596f4b
commit cab368a115
15 changed files with 138 additions and 253 deletions

15
commit-push.bat Normal file
View file

@ -0,0 +1,15 @@
@echo-off
cd /d D:\maga\magricambi
git status
echo.
set /p MSG=Messaggio commit:
if "%MSG%"=="" (
echo Messaggio obbligatorio.
exit /b 1
)
git add .
git status
set /p OK="Proceder con commit e push?" (s/N):
if /i not "%OK%" == "s" exit /b 0
git commit -m "%MSG%"
git push -u origin main

View file

@ -1,41 +0,0 @@
// [slug]/page.tsx
interface Post {
slug: string;
title: string;
content: string;
}
const blogPosts: Post[] = [
{
slug: "primo-post",
title: "Il mio primo post",
content: "Questo è il contenuto del primo post...",
},
{
slug: "secondo-post",
title: "Il mio secondo post",
content: "Questo è il contenuto del secondo post...",
},
{
slug: "terzo-post",
title: "Il mio terzo post",
content: "Questo è il contenuto del terzo post...",
},
];
/** Next 14: `params` è un oggetto sincrono. */
export default async function BlogPost({ params }: { params: Promise<{ slug: string }> }) {
const {slug} = await params;
const post = blogPosts.find((p) => p.slug === slug);
if (!post) {
return <div>Post non trovato</div>;
}
return (
<article className="max-w-4xl mx-auto p-8">
<h1 className="text-3xl font-bold mb-4">{post.title}</h1>
<p>{post.content}</p>
</article>
);
}

View file

@ -1,3 +0,0 @@
export default function Categorie(){
return <h1>Blog Categorie</h1>
}

View file

@ -1,49 +0,0 @@
import Link from "next/link";
interface Post {
slug: string;
title: string;
excerpt: string;
}
const blogPosts: Post[]= [
{
slug: "primo-post",
title: "Il mio primo post",
excerpt: "Una breve introduzione al mio primo post...",
},
{
slug: "secondo-post",
title: "Il mio secondo post",
excerpt: "Qualcosa di interessante sul seondo post",
},
{
slug: "terzo post",
title: "Il mio terzo post",
excerpt: "Un altro post interessante da leggere",
}
]
export default function BlogPage() {
return (
<div className="max-w-4xl mx-auto p-8">
<h1 className="text-3xl font-bold mb-8">Blog</h1>
<div className="space-y-6">
{ blogPosts.map((post) => (
<article key={post.slug} className="p-6 bg-zinc-800 reounded-lg">
<h2 className="text-xl font-bold mb-2">
<Link href={`/blog/${post.slug}`}
className="hover:text-zinc-200 transition-colors">
{post.title}
</Link>
</h2>
<p className="text-zinc-400">{post.excerpt}</p>
</article>
))}
</div>
</div>
);
}

View file

@ -1,48 +0,0 @@
interface DocPage {
path: string[],
title: string,
content: string,
}
interface DocPageProps {
params: Promise<{
slug: string[];
}>
}
const docs: DocPage[] = [
{
path: ["intro"],
title: "Introduzione",
content: "Benvenuti alla documentazione...",
},
{
path: ["intro", "getting-started"],
title: "Getting Started",
content: "Ecco come iniziare...",
},
{
path: ["advanced", "configuration"],
title: "Configurazione Avanzata",
content: "Configurazioni dettagliate..."
},
];
export default async function DocPage({ params }: DocPageProps) {
const { slug } = await params;
const doc = docs.find(doc => doc.path.join("/") === slug.join("/"));
if (!doc) {
return <div>Pagina non trovata</div>;
}
return (
<div className="max-w-4xl ma-auto p-8">
<h1 className="text-3xl font-bold mb-4">{doc.title}</h1>
<p>{doc.content}</p>
<div className="mt-r text-sm text-gray-500">Path: /{slug.join("/")}</div>
</div>
)
}

View file

@ -1,67 +0,0 @@
//app/docs/page.tsx
import Link from "next/link";
interface DocSection {
path: string;
title: string;
subsections?: { path: string; title: string}[];
}
// dati hardcodati
const docSections: DocSection[] = [
{
path: "intro",
title: "introduzione",
subsections: [
{ path: "getting-started", title: "Getting Started"},
{ path: "installation", title: "Installazione"},
],
},
{
path: "advanced",
title: "Guide Avanzate",
subsections: [
{path: "configuration", title: "Configurazione"},
{path: "deployment", title: "Deployment"},
],
},
];
export default function DocPage() {
return (
<div className="max-w-4xl mx-auro p-8">
<h1 className="text-3xl font-bold mb-g">Documentazione</h1>
<div className="space-y-8">
{docSections.map((section)=> (
<div key={section.path} className="bg-zinc-800 rounded-lg p-6">
<h2 className="text-xl font-bold mb-4">
<Link
href={`/docs/${section.path}
`}
className="hover:text-zinc-300 transition-colors">
{section.title}
</Link>
</h2>
{section.subsections && (
<ul className="space-y-2 ml-4">{section.subsections.map((sub)=> {
return (
<li key={sub.path}>
<Link
href={`/docs/${section.path}/${sub.path}`}
className="text-zinc-400 hover:text-zinc-300 transition-colors"
>
{sub.title}
</Link>
</li>)
})}
</ul>
)}
</div>
))}
</div>
</div>
)
}

View file

@ -1,23 +0,0 @@
import { redirect } from "next/navigation";
export default function ContentLayout({
children,
}: {
children: React.ReactNode;
}) {
const user = false;
if (!user) {
redirect("/");
}
return (
<div>
<p className="bg-violet-700 text-white w-full text-center py-2">
Sono del layout (content)
</p>
<main>{children}</main>
</div>
);
}

View file

View file

View file

@ -0,0 +1,3 @@
export default function Movimenti(){
return <h1>Movimenti</h1>
}

View file

@ -0,0 +1,8 @@
import Link from "next/link";
export default function Utenti() {
return <>
<h1>Utenti</h1>
<Link href="/utenti">Utenti</Link>
</>
}

View file

@ -1,3 +0,0 @@
export default function About(){
return <h1>About page</h1>
}

View file

@ -1,9 +0,0 @@
import Link from "next/link";
export default function Contact() {
return <>
<h1>Contatti</h1>
<Link href="/about">about1</Link>
<a href="/about">about2</a>
</>
}

View file

@ -5,18 +5,120 @@
// @version: "1.0.0 2026-05-07"
//====================================
"use client"
import { useState , MouseEvent} from "react";
import Link from "next/link";
interface NavLink {
href: string;
label: string;
}
interface ServiceLink {
href: string;
label: string;
}
const navLinks: NavLink[] = [
{ href: "/", label: "Home"},
{ href: "/movimenti", label: "Movimenti"},
{ href: "/articoli", label: "Articoli"},
{ href: "/macchine", label: "Macchine"},
{ href: "/utenti", label: "Utenti"},
];
const serviceLinks: ServiceLink[] = [
{ href: "/services/web", label: "Web Development"},
{ href: "/services/mobile", label: "Mobile Development"},
{ href: "/services/consulting", label: "Consulting"},
]
export default function Navbar() {
return (
<>
<div className="flex direction-row gap-7" >
<div className="text-3xl">Home</div>
<div className="text-3xl">About</div>
<div className="text-3xl">Document</div>
<div className="text-3xl">Contact</div>
<div className="text-3xl">Sources</div>
</div>
</>
)
const [ isServicesOpen, setIsServicesOpen] = useState<boolean>(false);
const toggleServices = ( e: MouseEvent<HTMLButtonElement>) => {
e.preventDefault();
setIsServicesOpen(!isServicesOpen);
}
return (
<nav className="border-b border-zinc-800 bg-black">
<div className="max-w-4xl mx-auto px-4">
<div className="flex justify-between h-16">
{/* Logo */}
<Link
href="/"
className="flex items-center font-bold text-zinc-100 hover:text-zinc-300 transition-colors"
>
LOGO
</Link>
{/* Navigation */}
<div className="flex space-x-8">
{/* Link normali */}
{navLinks.map((link) => (
<Link
key={link.href}
href={link.href}
className="flex items-center text-zinc-300 hover:text-zinc-100 transition-colors"
>
{link.label}
</Link>
))}
{/* Dropdown menu */}
<div className="relative flex items-center">
<button
className="flex items-center text-zinc-300 hover:text-zinc-100 transition-colors"
onClick={toggleServices}
aria-expanded={isServicesOpen}
aria-label="Toggle services menu"
>
Services
<svg
className={`ml-1 h-4 w-4 transition-transform duration-300 ${isServicesOpen ? "rotate-180" : ""
}`}
fill="none"
stroke="currentColor"
viewBox="0 0 24 24"
>
<path
strokeLinecap="round"
strokeLinejoin="round"
strokeWidth={2}
d="M19 9l-7 7-7-7"
/>
</svg>
</button>
{/* Menu dropdown */}
{isServicesOpen && (
<div
className="absolute top-full mt-2 w-48 bg-zinc-800 rounded-md shadow-lg py-1 border border-zinc-700"
role="menu"
aria-orientation="vertical"
>
{serviceLinks.map((service) => (
<Link
key={service.href}
href={service.href}
className="block px-4 py-2 text-zinc-300 hover:bg-zinc-700 hover:text-zinc-100 transition-colors"
>
{service.label}
</Link>
))}
</div>
)}
</div>
</div>
</div>
</div>
</nav>
);
}