Make the landing page a box canvas, and add Link box templates
The fixed bio-and-links page is gone; / is now an editable canvas (page key "index") like /stp. The old content is kept as boxes in landingLayout.js behind an "Import old landing page" button, which now shows on a non-empty canvas too and confirms before adding. The overlay mode only the landing page used is removed from BoxCanvas. New "Link" and "Link row" HTML templates give bordered link buttons that open with target=_top/_blank, since the box is a sandboxed frame. Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
@@ -82,7 +82,7 @@ Dockerized multi-service personal website self-hosted on a Raspberry Pi.
|
|||||||
- `src/graphql.js` — thin axios-based GraphQL client (`POST /api/graphql`)
|
- `src/graphql.js` — thin axios-based GraphQL client (`POST /api/graphql`)
|
||||||
- `src/api.js` — thin REST client for the `/api` JSON endpoints; failures become an `ApiError` carrying the backend's `error` message and the status
|
- `src/api.js` — thin REST client for the `/api` JSON endpoints; failures become an `ApiError` carrying the backend's `error` message and the status
|
||||||
- `src/stores/` — Pinia stores for auth, posts, favorites, activities, songs, messages, homeData, places, boxes, pages. `createCrudStore.js` is the factory behind places, boxes and pages; `createMirrorStore.js` is the one behind the home-page slices
|
- `src/stores/` — Pinia stores for auth, posts, favorites, activities, songs, messages, homeData, places, boxes, pages. `createCrudStore.js` is the factory behind places, boxes and pages; `createMirrorStore.js` is the one behind the home-page slices
|
||||||
- `src/views/` — page components (Home, Admin, CV, Notes, Bookmarks, shrines). `/stp` is `views/home3/Home3.vue`: a canvas of admin-arranged boxes (built-in widgets or sandboxed-iframe HTML) stored as the `Box` GraphQL type. The canvas (`views/home3/BoxCanvas.vue`) is reusable per page key: the landing page overlays one for notes, and admin-created `Page`s (e.g. shrines) are served at `/<slug>` by the router's catch-all, `views/canvas/CanvasPage.vue`. Boxes and pages can be admin-only, filtered server-side. See "The /stp canvas" in `vue/README.md`
|
- `src/views/` — page components (Home, Admin, CV, Notes, Bookmarks, shrines). `/stp` is `views/home3/Home3.vue`: a canvas of admin-arranged boxes (built-in widgets or sandboxed-iframe HTML) stored as the `Box` GraphQL type. The canvas (`views/home3/BoxCanvas.vue`) is reusable per page key: the landing page (`/`) is one too, and admin-created `Page`s (e.g. shrines) are served at `/<slug>` by the router's catch-all, `views/canvas/CanvasPage.vue`. Boxes and pages can be admin-only, filtered server-side. See "The /stp canvas" in `vue/README.md`
|
||||||
- `src/components/` — reusable UI components
|
- `src/components/` — reusable UI components
|
||||||
- `src/assets/styles.css` — design tokens (Tailwind `@theme`), base element styles, shared classes and transitions. `layouts/CVLayout.vue` re-points the colour tokens for the light CV theme. See "Styling" in `vue/README.md`.
|
- `src/assets/styles.css` — design tokens (Tailwind `@theme`), base element styles, shared classes and transitions. `layouts/CVLayout.vue` re-points the colour tokens for the light CV theme. See "Styling" in `vue/README.md`.
|
||||||
|
|
||||||
|
|||||||
+10
-9
@@ -65,7 +65,7 @@ Two layout shells, defined in `src/router/index.js`:
|
|||||||
|
|
||||||
| Path | Layout | Notes |
|
| Path | Layout | Notes |
|
||||||
| --- | --- | --- |
|
| --- | --- | --- |
|
||||||
| `/` | DefaultLayout | Landing page (statically imported — it's the first paint), with a canvas overlay for pinned notes (page key `index`) |
|
| `/` | DefaultLayout | Landing page (statically imported — it's the first paint): a box canvas, page key `index`; the old fixed page is its starter layout, `views/landing/landingLayout.js` |
|
||||||
| `/stp` | DefaultLayout | The personal home page: an admin-editable canvas of boxes (`views/home3/`, see "The /stp canvas" below) |
|
| `/stp` | DefaultLayout | The personal home page: an admin-editable canvas of boxes (`views/home3/`, see "The /stp canvas" below) |
|
||||||
| `/admin`, `/admin/login` | DefaultLayout | `/admin` is guarded by `meta.requiresAdmin` |
|
| `/admin`, `/admin/login` | DefaultLayout | `/admin` is guarded by `meta.requiresAdmin` |
|
||||||
| `/automata`, `/hotels`, `/shrines` | DefaultLayout | Each shrine under `/shrines/` is a canvas page |
|
| `/automata`, `/hotels`, `/shrines` | DefaultLayout | Each shrine under `/shrines/` is a canvas page |
|
||||||
@@ -205,10 +205,8 @@ so every visitor sees the saved layout. The canvas is `views/home3/BoxCanvas.vue
|
|||||||
and it is not only `/stp`: every box has a `page` key, and the same component
|
and it is not only `/stp`: every box has a `page` key, and the same component
|
||||||
renders any page's boxes.
|
renders any page's boxes.
|
||||||
|
|
||||||
- **Pages.** `"stp"` is `/stp` (`Home3.vue`). `"index"` is the landing page,
|
- **Pages.** `"stp"` is `/stp` (`Home3.vue`). `"index"` is the landing page
|
||||||
where the canvas is an `overlay` over the page's own content: it takes no
|
(`Landing.vue`), which is nothing but the canvas. Any other key is the slug of a **`Page`** (GraphQL
|
||||||
room when empty, lets clicks through except on boxes, and reports its height
|
|
||||||
so the page grows to fit. Any other key is the slug of a **`Page`** (GraphQL
|
|
||||||
type, `stores/pages.js`), an admin-created page served at `/<slug>` by the
|
type, `stores/pages.js`), an admin-created page served at `/<slug>` by the
|
||||||
router's catch-all (`views/canvas/CanvasPage.vue`). Pages are created from
|
router's catch-all (`views/canvas/CanvasPage.vue`). Pages are created from
|
||||||
the admin panel's Pages tab, from `/shrines`, or from the 404 of the address
|
the admin panel's Pages tab, from `/shrines`, or from the 404 of the address
|
||||||
@@ -244,13 +242,16 @@ renders any page's boxes.
|
|||||||
the save fails. `BoxEditor.vue` is the side panel. Settings save on change;
|
the save fails. `BoxEditor.vue` is the side panel. Settings save on change;
|
||||||
HTML is a draft that previews live and saves with Save or Ctrl/Cmd+S.
|
HTML is a draft that previews live and saves with Save or Ctrl/Cmd+S.
|
||||||
CodeMirror is loaded only when that panel opens; the panel is teleported to
|
CodeMirror is loaded only when that panel opens; the panel is teleported to
|
||||||
`<body>` so the landing overlay's `pointer-events: none` doesn't reach it.
|
`<body>`.
|
||||||
Image and video files dropped onto the canvas in edit mode are uploaded and
|
Image and video files dropped onto the canvas in edit mode are uploaded and
|
||||||
each becomes an unframed box at the drop point. "Insert upload" stores a
|
each becomes an unframed box at the drop point. "Insert upload" stores a
|
||||||
file through the chat's public upload endpoint and puts an `<img>`/`<video>`
|
file through the chat's public upload endpoint and puts an `<img>`/`<video>`
|
||||||
tag for it at the cursor. Starter HTML is in `templates.js`. On `/stp`,
|
tag for it at the cursor. Starter HTML is in `templates.js`; links in a box
|
||||||
"Import current layout" (shown only on an empty canvas) recreates the old
|
need `target="_top"` or `_blank` (the Link templates set it), or they open
|
||||||
`Home.vue` grid from `defaultLayout.js`.
|
inside the frame. A canvas given a `starter` has an import button in edit
|
||||||
|
mode (it confirms first if the page isn't empty): on `/stp`, "Import current
|
||||||
|
layout" recreates the old `Home.vue` grid from `defaultLayout.js`; on `/`,
|
||||||
|
"Import old landing page" recreates the old bio and links.
|
||||||
- **Phones (≤700px)** get no canvas: boxes stack full-width in `(y, x)` order at
|
- **Phones (≤700px)** get no canvas: boxes stack full-width in `(y, x)` order at
|
||||||
their saved height, skipping any with `hideOnMobile`. There is no separate
|
their saved height, skipping any with `hideOnMobile`. There is no separate
|
||||||
mobile layout. To change the order, move boxes on the desktop canvas.
|
mobile layout. To change the order, move boxes on the desktop canvas.
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
<script setup>
|
<script setup>
|
||||||
/**
|
/**
|
||||||
* A free-form canvas of boxes the admin arranges in the browser, for one page
|
* A free-form canvas of boxes the admin arranges in the browser, for one page
|
||||||
* key (see stores/boxes.js). Home3.vue (/stp), the landing page's overlay and
|
* key (see stores/boxes.js). Home3.vue (/stp), the landing page and every
|
||||||
* every admin-created page (views/canvas/CanvasPage.vue) are this component.
|
* admin-created page (views/canvas/CanvasPage.vue) are this component.
|
||||||
*
|
*
|
||||||
* Every box (the `Box` GraphQL type) has a position, size and z-index in px
|
* Every box (the `Box` GraphQL type) has a position, size and z-index in px
|
||||||
* on a fixed CANVAS_W-wide design canvas. The canvas is drawn at that width
|
* on a fixed CANVAS_W-wide design canvas. The canvas is drawn at that width
|
||||||
@@ -21,14 +21,6 @@
|
|||||||
* marked adminOnly are never sent to anyone else (the server filters them);
|
* marked adminOnly are never sent to anyone else (the server filters them);
|
||||||
* admins see them outlined. Image and video files dropped onto the canvas in
|
* admins see them outlined. Image and video files dropped onto the canvas in
|
||||||
* edit mode are uploaded and each becomes a box where it was dropped.
|
* edit mode are uploaded and each becomes a box where it was dropped.
|
||||||
*
|
|
||||||
* `overlay` lays the canvas over whatever the parent already renders instead
|
|
||||||
* of taking space of its own — the landing page uses it to pin notes over its
|
|
||||||
* fixed content. The parent must be position: relative; the canvas covers it
|
|
||||||
* from the top, lets clicks through everywhere except on boxes (until edit
|
|
||||||
* mode, which owns the whole area), and reports its height through `height`
|
|
||||||
* so the parent can grow to contain it. On a phone the overlay's boxes stack
|
|
||||||
* below the parent's content like any other canvas.
|
|
||||||
*/
|
*/
|
||||||
import { computed, onBeforeUnmount, onMounted, ref, watch } from "vue";
|
import { computed, onBeforeUnmount, onMounted, ref, watch } from "vue";
|
||||||
import { useMediaQuery } from "@vueuse/core";
|
import { useMediaQuery } from "@vueuse/core";
|
||||||
@@ -44,13 +36,11 @@ import { mediaSize, uploadFile } from "./upload";
|
|||||||
|
|
||||||
const props = defineProps({
|
const props = defineProps({
|
||||||
page: { type: String, required: true },
|
page: { type: String, required: true },
|
||||||
overlay: { type: Boolean, default: false },
|
// Layout offered by the "Import starter layout" button in edit mode: a
|
||||||
// Layout offered by "Import starter layout" on an empty canvas: a function
|
// function returning box inputs, or null for no button.
|
||||||
// returning box inputs, or null for no button.
|
|
||||||
starter: { type: Function, default: null },
|
starter: { type: Function, default: null },
|
||||||
starterLabel: { type: String, default: "Import starter layout" },
|
starterLabel: { type: String, default: "Import starter layout" },
|
||||||
});
|
});
|
||||||
const emit = defineEmits(["height"]);
|
|
||||||
|
|
||||||
const CANVAS_W = 1400;
|
const CANVAS_W = 1400;
|
||||||
const MOBILE_QUERY = "(max-width: 700px)";
|
const MOBILE_QUERY = "(max-width: 700px)";
|
||||||
@@ -98,17 +88,8 @@ watch(viewport, (el, old) => {
|
|||||||
const scale = computed(() => Math.min(1, availableW.value / CANVAS_W));
|
const scale = computed(() => Math.min(1, availableW.value / CANVAS_W));
|
||||||
const contentH = computed(() => Math.max(0, ...store.boxes.map((b) => b.y + b.h)));
|
const contentH = computed(() => Math.max(0, ...store.boxes.map((b) => b.y + b.h)));
|
||||||
// Spare room below the lowest box while editing, so there is somewhere to
|
// Spare room below the lowest box while editing, so there is somewhere to
|
||||||
// drag to. An overlay has no floor of its own: empty, it should take no room.
|
// drag to.
|
||||||
const canvasH = computed(() => {
|
const canvasH = computed(() => Math.max(400, contentH.value + (inEditMode.value ? 400 : 40)));
|
||||||
const floor = props.overlay && !inEditMode.value ? 0 : 400;
|
|
||||||
return Math.max(floor, contentH.value + (inEditMode.value ? 400 : 40));
|
|
||||||
});
|
|
||||||
|
|
||||||
watch(
|
|
||||||
() => (props.overlay && !isMobile.value ? canvasH.value * scale.value : 0),
|
|
||||||
(h) => emit("height", h),
|
|
||||||
{ immediate: true },
|
|
||||||
);
|
|
||||||
|
|
||||||
// ---- Mobile ordering -----------------------------------------------------
|
// ---- Mobile ordering -----------------------------------------------------
|
||||||
const stacked = computed(() =>
|
const stacked = computed(() =>
|
||||||
@@ -207,8 +188,13 @@ function addBox() {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Offered on a canvas that already has boxes too — the landing page had notes
|
||||||
|
// pinned over its old content before that content became boxes — but then
|
||||||
|
// it asks first, since importing twice doubles every box.
|
||||||
const importing = ref(false);
|
const importing = ref(false);
|
||||||
async function importStarter() {
|
async function importStarter() {
|
||||||
|
const count = store.boxes.length;
|
||||||
|
if (count && !confirm(`This page already has ${count} box${count === 1 ? "" : "es"}. Add the starter layout on top?`)) return;
|
||||||
importing.value = true;
|
importing.value = true;
|
||||||
try {
|
try {
|
||||||
// Sequential, so the boxes come back in z order without a refetch.
|
// Sequential, so the boxes come back in z order without a refetch.
|
||||||
@@ -292,15 +278,11 @@ function toggleEdit() {
|
|||||||
<template>
|
<template>
|
||||||
<div
|
<div
|
||||||
class="box-canvas"
|
class="box-canvas"
|
||||||
:class="{
|
:class="{ 'with-editor': inEditMode && selected }"
|
||||||
'with-editor': inEditMode && selected && !overlay,
|
|
||||||
overlay: overlay && !isMobile,
|
|
||||||
'overlay-editing': overlay && inEditMode,
|
|
||||||
}"
|
|
||||||
>
|
>
|
||||||
<div v-if="canEdit" class="admin-bar">
|
<div v-if="canEdit" class="admin-bar">
|
||||||
<button type="button" class="bar-btn" :class="{ on: editing }" @click="toggleEdit">
|
<button type="button" class="bar-btn" :class="{ on: editing }" @click="toggleEdit">
|
||||||
{{ editing ? "Done" : overlay ? "Edit notes" : "Edit layout" }}
|
{{ editing ? "Done" : "Edit layout" }}
|
||||||
</button>
|
</button>
|
||||||
<template v-if="inEditMode">
|
<template v-if="inEditMode">
|
||||||
<select v-model="newChoice" class="bar-btn" @change="addBox">
|
<select v-model="newChoice" class="bar-btn" @change="addBox">
|
||||||
@@ -313,7 +295,7 @@ function toggleEdit() {
|
|||||||
</optgroup>
|
</optgroup>
|
||||||
</select>
|
</select>
|
||||||
<button
|
<button
|
||||||
v-if="starter && store.loaded && store.boxes.length === 0"
|
v-if="starter && store.loaded"
|
||||||
type="button"
|
type="button"
|
||||||
class="bar-btn"
|
class="bar-btn"
|
||||||
:disabled="importing"
|
:disabled="importing"
|
||||||
@@ -330,7 +312,7 @@ function toggleEdit() {
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<p v-if="store.error" class="state">Couldn't load the page layout.</p>
|
<p v-if="store.error" class="state">Couldn't load the page layout.</p>
|
||||||
<p v-else-if="!overlay && store.loaded && store.boxes.length === 0 && !canEdit" class="state">
|
<p v-else-if="store.loaded && store.boxes.length === 0 && !canEdit" class="state">
|
||||||
Nothing here yet.
|
Nothing here yet.
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
@@ -404,38 +386,11 @@ function toggleEdit() {
|
|||||||
box-sizing: border-box;
|
box-sizing: border-box;
|
||||||
}
|
}
|
||||||
/* Leave room for the fixed editor panel so the canvas rescales beside it
|
/* Leave room for the fixed editor panel so the canvas rescales beside it
|
||||||
instead of disappearing under it. Not for an overlay: rescaling it would
|
instead of disappearing under it. */
|
||||||
pull its boxes off the content they are pinned over, so the panel just
|
|
||||||
covers the right of the page instead. */
|
|
||||||
.box-canvas.with-editor {
|
.box-canvas.with-editor {
|
||||||
padding-right: calc(min(460px, 100vw) + 16px);
|
padding-right: calc(min(460px, 100vw) + 16px);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Over the parent's content: only the boxes take clicks, so the page
|
|
||||||
underneath stays usable. In edit mode the whole area does, so a click on
|
|
||||||
empty canvas deselects rather than following a link underneath. */
|
|
||||||
.box-canvas.overlay {
|
|
||||||
position: absolute;
|
|
||||||
inset: 0 0 auto 0;
|
|
||||||
z-index: 20;
|
|
||||||
pointer-events: none;
|
|
||||||
}
|
|
||||||
.box-canvas.overlay :deep(.box),
|
|
||||||
.box-canvas.overlay .admin-bar,
|
|
||||||
.box-canvas.overlay-editing .canvas {
|
|
||||||
pointer-events: auto;
|
|
||||||
}
|
|
||||||
/* An overlay's bar must not push the canvas down off the content it is
|
|
||||||
aligned with, so it floats in the corner of the window — above the
|
|
||||||
layout's footer bar. */
|
|
||||||
.box-canvas.overlay .admin-bar {
|
|
||||||
position: fixed;
|
|
||||||
left: 16px;
|
|
||||||
bottom: 56px;
|
|
||||||
z-index: 70;
|
|
||||||
margin: 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
.admin-bar {
|
.admin-bar {
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-wrap: wrap;
|
flex-wrap: wrap;
|
||||||
|
|||||||
@@ -14,9 +14,8 @@
|
|||||||
* "Insert upload" uploads a file (upload.js) and puts a tag for it at the
|
* "Insert upload" uploads a file (upload.js) and puts a tag for it at the
|
||||||
* cursor — the way to add pictures to an existing box, e.g. a gallery.
|
* cursor — the way to add pictures to an existing box, e.g. a gallery.
|
||||||
*
|
*
|
||||||
* The panel is teleported to <body>. On the landing page the canvas is an
|
* The panel is teleported to <body>, so it is fixed to the window whatever
|
||||||
* overlay with pointer-events: none, which a panel rendered inside it would
|
* transform or stacking context the page puts around the canvas.
|
||||||
* inherit — it would show but ignore every click and keystroke.
|
|
||||||
*/
|
*/
|
||||||
import { computed, ref, watch } from "vue";
|
import { computed, ref, watch } from "vue";
|
||||||
import { useBoxesStore } from "@/stores/boxes";
|
import { useBoxesStore } from "@/stores/boxes";
|
||||||
|
|||||||
@@ -121,6 +121,26 @@ const TEXT = `<h3>Heading</h3>
|
|||||||
</p>
|
</p>
|
||||||
<blockquote>“A quote you like.”</blockquote>`;
|
<blockquote>“A quote you like.”</blockquote>`;
|
||||||
|
|
||||||
|
// Links. An HTML box is its own document in a sandboxed frame, so a link
|
||||||
|
// must name where it opens: target="_top" replaces the site page (a full
|
||||||
|
// load, not a router navigation — fine for leaving the page), and
|
||||||
|
// target="_blank" a new tab. Without a target it would load inside the box.
|
||||||
|
const LINK_STYLE = `<style>
|
||||||
|
body { display: grid; place-items: center; padding: 4px; }
|
||||||
|
.links { display: flex; flex-wrap: wrap; justify-content: space-around; gap: 1rem; }
|
||||||
|
a {
|
||||||
|
padding: .5rem 1rem; border: 1px solid currentColor;
|
||||||
|
color: var(--color-primary); text-decoration: none; font-size: 16px;
|
||||||
|
transition: color .15s ease;
|
||||||
|
}
|
||||||
|
a:hover { color: var(--color-tertiary); }
|
||||||
|
</style>`;
|
||||||
|
|
||||||
|
const linkHtml = (links) => `${LINK_STYLE}
|
||||||
|
<nav class="links">
|
||||||
|
${links.map(({ name, href }) => ` <a href="${href}" target="${href.startsWith("/") ? "_top" : "_blank"}">${name}</a>`).join("\n")}
|
||||||
|
</nav>`;
|
||||||
|
|
||||||
// A scrolling grid of images. "Insert upload" in the editor adds more.
|
// A scrolling grid of images. "Insert upload" in the editor adds more.
|
||||||
const galleryHtml = (srcs) => `<style>
|
const galleryHtml = (srcs) => `<style>
|
||||||
body { padding: 4px; }
|
body { padding: 4px; }
|
||||||
@@ -145,6 +165,17 @@ export const TEMPLATES = [
|
|||||||
{ label: "Note (admin only)", title: "Note", html: NOTE, size: [260, 200], framed: false, adminOnly: true },
|
{ label: "Note (admin only)", title: "Note", html: NOTE, size: [260, 200], framed: false, adminOnly: true },
|
||||||
{ label: "Heading", title: "Heading", html: HEADING, size: [600, 140], framed: false },
|
{ label: "Heading", title: "Heading", html: HEADING, size: [600, 140], framed: false },
|
||||||
{ label: "Text", title: "Text", html: TEXT, size: [400, 260] },
|
{ label: "Text", title: "Text", html: TEXT, size: [400, 260] },
|
||||||
|
{ label: "Link", title: "Link", html: linkHtml([{ name: "CV", href: "/cv" }]), size: [120, 60], framed: false },
|
||||||
|
{
|
||||||
|
label: "Link row",
|
||||||
|
title: "Links",
|
||||||
|
html: linkHtml([
|
||||||
|
{ name: "CV", href: "/cv" },
|
||||||
|
{ name: "GitHub", href: "https://github.com/SteveThePug" },
|
||||||
|
]),
|
||||||
|
size: [400, 70],
|
||||||
|
framed: false,
|
||||||
|
},
|
||||||
{ label: "Image / GIF", title: "Image", html: imageHtml("/img/memes/fire-woman.gif"), size: [240, 240], framed: false },
|
{ label: "Image / GIF", title: "Image", html: imageHtml("/img/memes/fire-woman.gif"), size: [240, 240], framed: false },
|
||||||
{ label: "Image gallery", title: "Gallery", html: galleryHtml(["/img/memes/fire-woman.gif", "/img/memes/epic.jpeg"]), size: [460, 320] },
|
{ label: "Image gallery", title: "Gallery", html: galleryHtml(["/img/memes/fire-woman.gif", "/img/memes/epic.jpeg"]), size: [460, 320] },
|
||||||
{ label: "Video", title: "Video", html: videoHtml("/img/demoman/1760582395316219.webm"), size: [400, 260], framed: false },
|
{ label: "Video", title: "Video", html: videoHtml("/img/demoman/1760582395316219.webm"), size: [400, 260], framed: false },
|
||||||
@@ -153,4 +184,4 @@ export const TEMPLATES = [
|
|||||||
{ label: "Empty HTML", title: "HTML", html: EMPTY, size: [300, 200] },
|
{ label: "Empty HTML", title: "HTML", html: EMPTY, size: [300, 200] },
|
||||||
];
|
];
|
||||||
|
|
||||||
export { imageHtml, galleryHtml, videoHtml };
|
export { imageHtml, galleryHtml, videoHtml, linkHtml };
|
||||||
|
|||||||
@@ -1,90 +1,32 @@
|
|||||||
<script setup>
|
<script setup>
|
||||||
/**
|
/**
|
||||||
* Route `/` — the professional front door. Deliberately plain: a short bio and a
|
* Route `/` — the front door, as a box canvas (page key "index") the admin
|
||||||
* row of links out to the CV, the personal home page (/stp), the shrines, the
|
* arranges in the browser like /stp. The fixed bio-and-links page it
|
||||||
* projects that run as their own containers, and social profiles.
|
* replaced is kept as boxes in landingLayout.js, behind the canvas's import
|
||||||
* Statically imported by the router (it is the first paint).
|
* button.
|
||||||
*
|
*
|
||||||
* Over it lies a BoxCanvas overlay (page key "index"), where the admin pins
|
* Statically imported by the router (it is the first paint), but the canvas
|
||||||
* notes and anything else; admin-only notes are never sent to visitors. With
|
* is loaded in its own chunk: it brings the box editor with it.
|
||||||
* no boxes the overlay takes no room and the page is exactly as before.
|
|
||||||
*/
|
*/
|
||||||
import { defineAsyncComponent, ref } from "vue";
|
import { defineAsyncComponent } from "vue";
|
||||||
import Link from "@/components/text/Link.vue";
|
import { landingLayout } from "./landingLayout";
|
||||||
import InlineLink from "@/components/text/InlineLink.vue";
|
|
||||||
import Header from "@/components/text/Header.vue";
|
|
||||||
import Paragraph from "@/components/text/Paragraph.vue";
|
|
||||||
|
|
||||||
// The projects are nginx routes to other containers, not SPA routes, so they
|
|
||||||
// must be plain hrefs: a RouterLink would resolve them client-side to the 404.
|
|
||||||
const projects = [
|
|
||||||
{ name: "Jobs", href: "/jobs/" },
|
|
||||||
{ name: "Tracker", href: "/tracker/" },
|
|
||||||
{ name: "USACO", href: "/usaco/" },
|
|
||||||
];
|
|
||||||
|
|
||||||
// Loaded after first paint, in its own chunk: the landing page is the one
|
|
||||||
// view in the main bundle, and the canvas brings the box editor with it.
|
|
||||||
const BoxCanvas = defineAsyncComponent(() =>
|
const BoxCanvas = defineAsyncComponent(() =>
|
||||||
import("@/views/home3/BoxCanvas.vue"),
|
import("@/views/home3/BoxCanvas.vue"),
|
||||||
);
|
);
|
||||||
|
|
||||||
// The overlay is absolutely positioned, so the page grows to contain it.
|
|
||||||
const overlayHeight = ref(0);
|
|
||||||
|
|
||||||
const links = [
|
|
||||||
{ name: "GitHub", href: "https://github.com/SteveThePug" },
|
|
||||||
{ name: "Gitea", href: "/gitea/explore/repos" },
|
|
||||||
{ name: "Spotify", href: "https://open.spotify.com/user/stevethepug" },
|
|
||||||
];
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<main class="relative" :style="{ minHeight: `${overlayHeight}px` }">
|
<main class="landing">
|
||||||
<div class="flex justify-center px-4 py-16">
|
<BoxCanvas page="index" :starter="landingLayout" starter-label="Import old landing page" />
|
||||||
<div class="max-w-xl w-full flex flex-col gap-12">
|
|
||||||
<section>
|
|
||||||
<Header>Adam French</Header>
|
|
||||||
<Paragraph>
|
|
||||||
Junior software engineer focused on full-stack development, systems
|
|
||||||
programming, and infrastructure. First Class Honours in Computer
|
|
||||||
Science with Mathematics from Leeds and Waterloo.
|
|
||||||
</Paragraph>
|
|
||||||
</section>
|
|
||||||
|
|
||||||
<section>
|
|
||||||
<Header>About</Header>
|
|
||||||
<Paragraph>
|
|
||||||
This website is self-hosted and has a lot more on it than it needs to.
|
|
||||||
Please have a look at my
|
|
||||||
<InlineLink to="/cv">CV</InlineLink> for a full breakdown of my
|
|
||||||
experience, projects, and skills. Please visit
|
|
||||||
<InlineLink to="/stp">STP</InlineLink> for the prefered but less
|
|
||||||
professional experience.
|
|
||||||
</Paragraph>
|
|
||||||
</section>
|
|
||||||
|
|
||||||
<nav class="navRow flex flex-row flex-wrap gap-4 justify-around">
|
|
||||||
<Link to="/cv"> CV </Link>
|
|
||||||
<Link to="/stp"> STP </Link>
|
|
||||||
<Link to="/shrines"> Shrines </Link>
|
|
||||||
<Link v-for="p in projects" :key="p.name" :href="p.href">
|
|
||||||
{{ p.name }}
|
|
||||||
</Link>
|
|
||||||
<Link href="mailto:[email protected]"> Email </Link>
|
|
||||||
<Link v-for="link in links" :key="link.name" :href="link.href">
|
|
||||||
{{ link.name }}
|
|
||||||
</Link>
|
|
||||||
</nav>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<BoxCanvas page="index" overlay @height="overlayHeight = $event" />
|
|
||||||
</main>
|
</main>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<style scoped>
|
<style scoped>
|
||||||
.navRow > a {
|
.landing {
|
||||||
padding: 0.5rem 1rem;
|
width: 100%;
|
||||||
border: 1px solid currentColor;
|
min-height: 100%;
|
||||||
|
box-sizing: border-box;
|
||||||
|
padding: 10px 16px;
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
@@ -0,0 +1,79 @@
|
|||||||
|
/**
|
||||||
|
* The pre-canvas landing page (a bio, an about paragraph and a row of links)
|
||||||
|
* redrawn as boxes, for the "Import old landing page" button on its canvas.
|
||||||
|
*
|
||||||
|
* The old page was a 576px column (max-w-xl) centred in the window, 64px
|
||||||
|
* from the top, with 48px between sections. On the 1400px design canvas that
|
||||||
|
* centre is x = 412; the heights are the old sections' rendered heights,
|
||||||
|
* rounded up. Boxes are unframed, as the old page had no frames.
|
||||||
|
*/
|
||||||
|
import { linkHtml } from "@/views/home3/templates";
|
||||||
|
|
||||||
|
const COLUMN = { x: 412, w: 576 };
|
||||||
|
const GAP = 48;
|
||||||
|
|
||||||
|
// Header.vue's heading-with-a-rule and Paragraph.vue's padded <p>, restated
|
||||||
|
// for the frame, which inherits none of the site's CSS.
|
||||||
|
const SECTION_STYLE = `<style>
|
||||||
|
body { padding: 0; font-size: 16px; }
|
||||||
|
h1 { margin: .25rem; padding-bottom: 2px; border-bottom: 1px solid var(--color-primary); font-size: 1.5rem; }
|
||||||
|
p { margin: 1rem 0; padding: .25rem; line-height: 1.5; }
|
||||||
|
a { font-weight: bold; font-style: italic; text-decoration: none; }
|
||||||
|
a:hover { color: var(--color-tertiary); }
|
||||||
|
</style>`;
|
||||||
|
|
||||||
|
const section = (heading, body) => `${SECTION_STYLE}
|
||||||
|
<h1>${heading}</h1>
|
||||||
|
<p>
|
||||||
|
${body}
|
||||||
|
</p>`;
|
||||||
|
|
||||||
|
const SECTIONS = [
|
||||||
|
{
|
||||||
|
title: "Bio",
|
||||||
|
h: 170,
|
||||||
|
html: section(
|
||||||
|
"Adam French",
|
||||||
|
`Junior software engineer focused on full-stack development, systems
|
||||||
|
programming, and infrastructure. First Class Honours in Computer
|
||||||
|
Science with Mathematics from Leeds and Waterloo.`,
|
||||||
|
),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: "About",
|
||||||
|
h: 200,
|
||||||
|
html: section(
|
||||||
|
"About",
|
||||||
|
`This website is self-hosted and has a lot more on it than it needs to.
|
||||||
|
Please have a look at my <a href="/cv" target="_top">CV</a> for a full
|
||||||
|
breakdown of my experience, projects, and skills. Please visit
|
||||||
|
<a href="/stp" target="_top">STP</a> for the prefered but less
|
||||||
|
professional experience.`,
|
||||||
|
),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: "Links",
|
||||||
|
h: 110,
|
||||||
|
html: linkHtml([
|
||||||
|
{ name: "CV", href: "/cv" },
|
||||||
|
{ name: "STP", href: "/stp" },
|
||||||
|
{ name: "Shrines", href: "/shrines" },
|
||||||
|
{ name: "Jobs", href: "/jobs/" },
|
||||||
|
{ name: "Tracker", href: "/tracker/" },
|
||||||
|
{ name: "USACO", href: "/usaco/" },
|
||||||
|
{ name: "Email", href: "mailto:[email protected]" },
|
||||||
|
{ name: "GitHub", href: "https://github.com/SteveThePug" },
|
||||||
|
{ name: "Gitea", href: "/gitea/explore/repos" },
|
||||||
|
{ name: "Spotify", href: "https://open.spotify.com/user/stevethepug" },
|
||||||
|
]),
|
||||||
|
},
|
||||||
|
];
|
||||||
|
|
||||||
|
export function landingLayout() {
|
||||||
|
let y = 64;
|
||||||
|
return SECTIONS.map(({ title, h, html }, i) => {
|
||||||
|
const box = { kind: "html", title, html, framed: false, ...COLUMN, y, h, z: i + 1 };
|
||||||
|
y += h + GAP;
|
||||||
|
return box;
|
||||||
|
});
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user