HifiPlanet-Website/hifi/assets/GalleryBrands-Be9ZUHmO.js
Max Olchov d4eca5846d
SEO: Google kann Inhalte laden, sieht Deutsch, alte Adressen per 301
- robots.txt sperrt /api nicht mehr (Google lädt beim Rendern alle Inhalte
  und Bilder über die API); API-Antworten tragen dafür X-Robots-Tag: noindex
- Suchmaschinen bekommen immer die deutsche Seite statt der englischen
- page.php: 301 von Adressen der alten Website (/car-hifi/, /oldtimer/,
  /umbauten-einbauten/..., /ueber-uns/ ...) und von Adressen mit "/" am Ende;
  unbekannte Adressen liefern echten Status 404
- Modellbilder auf der Markenseite mit Alt-Text

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01E4MG4y7kh1e72NTWq98Q8M
2026-10-27 00:18:26 +00:00

1 line
4.9 KiB
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

import{r as l,v as R,w as M,j as e,c as m}from"./index-gdxW-Q9g.js";import F from"./ImageUploadField-Clc_hod0.js";import{S as C,s as E}from"./SortableList-V8jQUhd_.js";import{V as k}from"./ViewOnSite-PsFwtGo6.js";import"./resizeImage-C6PvAwh0.js";import"./sortable.esm-CEVsMzSe.js";import"./grip-vertical-DAJ-PS9o.js";const h={name:"",cover_image_path:"",sort_order:0};function V(){const[o,d]=l.useState([]),[a,c]=l.useState(h),[N,g]=l.useState(h),[s,p]=l.useState(null),[b,f]=l.useState(""),j=l.useRef(null),i=R();M(JSON.stringify(a)!==JSON.stringify(N),"gallery-brands");const x=()=>m.get("/gallery-brands").then(d);l.useEffect(()=>{x()},[]);const y=t=>{var n;const r={name:t.name,cover_image_path:t.cover_image_path||"",sort_order:t.sort_order};p(t.id),c(r),g(r),(n=j.current)==null||n.scrollIntoView({behavior:"smooth",block:"start"})},u=()=>{p(null),c(h),g(h)},v=async t=>{t.preventDefault(),f("");try{if(s)await m.put(`/gallery-brands/${s}`,a);else{const r=o.reduce((n,S)=>Math.max(n,Number(S.sort_order)||0),0)+10;await m.post("/gallery-brands",{...a,sort_order:r})}i.success(s?"Marke gespeichert.":"Marke angelegt."),u(),x()}catch(r){f(r.message)}},w=async t=>{if(confirm("Marke inkl. aller Projekte/Fotos wirklich löschen?"))try{await m.delete(`/gallery-brands/${t}`),s===t&&u(),i.success("Marke gelöscht."),x()}catch(r){i.error(`Löschen fehlgeschlagen: ${r.message}`)}},_=async t=>{const r=o;d(t);try{d(await E("gallery-brands",t)),i.success("Reihenfolge gespeichert.")}catch(n){d(r),i.error(`Reihenfolge konnte nicht gespeichert werden: ${n.message}`)}};return e.jsxs("div",{className:"grid gap-6 lg:grid-cols-3",children:[e.jsxs("div",{className:"lg:col-span-2",children:[e.jsxs("div",{className:"mb-4 flex items-center justify-between gap-3",children:[e.jsx("h1",{className:"text-xl font-bold text-neutral-900 dark:text-white",children:"Galerie-Marken"}),e.jsx(k,{to:"/galerie"})]}),e.jsx("p",{className:"mb-3 text-sm text-neutral-500 dark:text-neutral-400",children:"Reihenfolge am Griff links per Ziehen ändern."}),e.jsxs("div",{className:"overflow-x-auto rounded-xl border border-neutral-200 dark:border-neutral-800",children:[e.jsxs("table",{className:"w-full text-left text-sm",children:[e.jsx("thead",{className:"bg-neutral-50 text-neutral-500 dark:bg-neutral-900 dark:text-neutral-400",children:e.jsxs("tr",{children:[e.jsx("th",{className:"w-10 px-2 py-2",children:e.jsx("span",{className:"sr-only",children:"Reihenfolge"})}),e.jsx("th",{className:"px-4 py-2",children:"Bild"}),e.jsx("th",{className:"px-4 py-2",children:"Name"}),e.jsx("th",{className:"px-4 py-2 text-right",children:"Aktionen"})]})}),e.jsx(C,{items:o,onReorder:_,as:"tbody",className:"divide-y divide-neutral-100 dark:divide-neutral-800",children:(t,r)=>e.jsxs(e.Fragment,{children:[e.jsx("td",{className:"bg-white px-2 py-2 dark:bg-neutral-950",children:r}),e.jsx("td",{className:"bg-white px-4 py-2 dark:bg-neutral-950",children:t.cover_image_path?e.jsx("img",{src:t.cover_image_path,alt:"",className:"h-10 w-10 rounded-md object-cover"}):e.jsx("span",{className:"flex h-10 w-10 items-center justify-center rounded-md bg-neutral-100 text-xs text-neutral-400 dark:bg-neutral-800",children:"–"})}),e.jsxs("td",{className:"bg-white px-4 py-2 font-medium text-neutral-800 dark:bg-neutral-950 dark:text-neutral-100",children:[t.name,e.jsx(k,{to:`/galerie/${t.slug}`,className:"ml-2"})]}),e.jsxs("td",{className:"whitespace-nowrap bg-white px-4 py-2 text-right dark:bg-neutral-950",children:[e.jsx("button",{onClick:()=>y(t),className:"mr-3 text-brand-600 hover:underline",children:"Bearbeiten"}),e.jsx("button",{onClick:()=>w(t.id),className:"text-red-600 hover:underline",children:"Löschen"})]})]})})]}),o.length===0&&e.jsx("p",{className:"px-4 py-6 text-center text-sm text-neutral-400",children:"Noch keine Galerie-Marken angelegt."})]})]}),e.jsxs("form",{ref:j,onSubmit:v,className:"h-fit scroll-mt-20 space-y-4 rounded-xl border border-neutral-200 bg-white p-5 dark:border-neutral-800 dark:bg-neutral-900",children:[e.jsx("h2",{className:"font-bold text-neutral-900 dark:text-white",children:s?"Marke bearbeiten":"Neue Marke"}),e.jsxs("div",{children:[e.jsx("label",{className:"mb-1 block text-sm font-medium text-neutral-700 dark:text-neutral-300",children:"Name *"}),e.jsx("input",{required:!0,value:a.name,onChange:t=>c({...a,name:t.target.value}),className:"w-full rounded-md border border-neutral-300 bg-white px-3 py-2 text-sm dark:border-neutral-700 dark:bg-neutral-900"})]}),e.jsx(F,{value:a.cover_image_path,onChange:t=>c({...a,cover_image_path:t}),aspect:4/3,label:"Titelbild (optional)"}),b&&e.jsx("p",{className:"text-sm text-red-600",children:b}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx("button",{type:"submit",className:"rounded-md bg-brand-500 px-4 py-2 text-sm font-semibold text-white hover:bg-brand-600",children:s?"Speichern":"Anlegen"}),s&&e.jsx("button",{type:"button",onClick:u,className:"rounded-md border border-neutral-300 px-4 py-2 text-sm dark:border-neutral-700",children:"Abbrechen"})]})]})]})}export{V as default};