/stp is now views/home3/Home3.vue: boxes an admin creates, drags, resizes and edits in the browser, saved to the database so every visitor sees the same layout. - backend: a Box GraphQL type (kind widget|html, x/y/w/h/z in px on a 1400px design canvas, framed, hideOnMobile). Public `boxes` query; create/update/delete are @admin. Geometry is clamped rather than rejected. Framed has no gorm default, since GORM would turn an explicit false into true on insert. - vue: widget boxes render the existing widgets from a registry; html boxes render in an iframe sandboxed with allow-scripts and no allow-same-origin, so admin script can't read cookies or call /api. The site tokens and fonts (inlined as data: URLs) are injected into each frame. The canvas scales to fit the window; phones get a single column in (y, x) order. Edit mode saves geometry on release and has a CodeMirror side panel (lazy-loaded) with a live HTML preview. Templates cover Clock, Weather (Open-Meteo) and Image/GIF. "Import current layout" recreates the old Home.vue grid on an empty canvas. - Home.vue is kept with a STATUS: legacy header. Docs updated. Co-Authored-By: Claude Opus 5.5 <[email protected]>
61 lines
1.1 KiB
GraphQL
61 lines
1.1 KiB
GraphQL
# Boxes on the home page canvas (/stp). Anyone may read the layout — it is
|
|
# the page — but only an admin may change it. x/y/w/h are px on a fixed
|
|
# 1400px-wide design canvas; see models.Box.
|
|
#
|
|
# kind is "widget" (a built-in Vue component named by `widget`) or "html"
|
|
# (`html` rendered in a sandboxed iframe on the front end).
|
|
|
|
type Box {
|
|
id: ID!
|
|
createdAt: Time!
|
|
updatedAt: Time!
|
|
kind: String!
|
|
widget: String
|
|
html: String
|
|
title: String
|
|
x: Int!
|
|
y: Int!
|
|
w: Int!
|
|
h: Int!
|
|
z: Int!
|
|
framed: Boolean!
|
|
hideOnMobile: Boolean!
|
|
}
|
|
|
|
input CreateBoxInput {
|
|
kind: String!
|
|
widget: String
|
|
html: String
|
|
title: String
|
|
x: Int
|
|
y: Int
|
|
w: Int
|
|
h: Int
|
|
z: Int
|
|
framed: Boolean
|
|
hideOnMobile: Boolean
|
|
}
|
|
|
|
input UpdateBoxInput {
|
|
widget: String
|
|
html: String
|
|
title: String
|
|
x: Int
|
|
y: Int
|
|
w: Int
|
|
h: Int
|
|
z: Int
|
|
framed: Boolean
|
|
hideOnMobile: Boolean
|
|
}
|
|
|
|
extend type Query {
|
|
boxes: [Box!]!
|
|
}
|
|
|
|
extend type Mutation {
|
|
createBox(input: CreateBoxInput!): Box! @admin
|
|
updateBox(id: ID!, input: UpdateBoxInput!): Box! @admin
|
|
deleteBox(id: ID!): Box! @admin
|
|
}
|