feat(home): link the homepage of every local project in the workspace

- server: GET /api/local-projects scans sibling folders for index.html
  (title from <title>/<h1>, generic titles fall back to the folder name,
  sorted by newest edit) and GET /projects/<folder>/ serves that folder
- both endpoints are loopback-only; node_modules/.git/.hermes blocked and
  path traversal rejected; WORKSPACE_DIR=none disables the feature
- home: new 'โปรเจคในเครื่อง' list (2 columns >=700px) that hides itself when
  the API is absent, so the live static site never shows fake rows
- SW skips /projects/* so other projects' files are never cached; version 2026.11.19.5
- docs: README/AGENTS/DESIGN cover the endpoints, the loopback rule and the layout
This commit is contained in:
Bkk1234 committed 2026-11-20 14:26:54 +07:00
1 parent b27acd40ee
commit db7724b237
9 files changed
+417 -5

No files matched your search

+117
View File
@@ -400,6 +400,123 @@
cursor: grab;
}
/* ------------------------------------------------ โปรเจคในเครื่อง (localhost) */
.local-section {
margin-top: var(--space-4);
}
.local-section[hidden] {
display: none;
}
.local-list {
list-style: none;
margin: 0;
padding: 0;
display: flex;
flex-direction: column;
gap: 8px;
}
.local-row__link {
display: flex;
align-items: center;
gap: var(--space-3);
min-height: 64px;
padding: 12px var(--space-4);
border: 1px solid var(--border);
border-radius: var(--radius-md);
background: var(--surface);
color: inherit;
text-decoration: none;
transition:
border-color 160ms var(--ease),
background 160ms var(--ease),
translate 160ms var(--ease);
}
.local-row__link:hover {
border-color: var(--brand-300);
background: var(--brand-50);
translate: 0 -1px;
text-decoration: none;
}
.local-row__icon {
flex: none;
display: grid;
place-items: center;
width: 34px;
height: 34px;
border-radius: 10px;
background: var(--brand-50);
border: 1px solid var(--brand-200);
color: var(--brand-700);
}
.local-row__icon svg {
width: 18px;
height: 18px;
}
.local-row__body {
flex: 1 1 auto;
min-width: 0;
display: flex;
flex-direction: column;
gap: 2px;
}
.local-row__title {
font-weight: 500;
color: var(--brand-900);
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.local-row__meta {
font-size: 12.5px;
color: var(--muted-foreground);
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.local-row__meta code {
font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
font-size: 11.5px;
background: var(--brand-50);
border: 1px solid var(--border);
border-radius: 5px;
padding: 0 5px;
}
.local-row__go {
flex: none;
display: inline-flex;
align-items: center;
gap: 6px;
font-size: 13.5px;
font-weight: 500;
color: var(--brand-700);
}
.local-row__go svg {
width: 16px;
height: 16px;
transition: transform 160ms var(--ease);
}
.local-row__link:hover .local-row__go svg {
transform: translateX(3px);
}
@media (max-width: 560px) {
.local-row__go-text {
display: none;
}
}
@media (min-width: 700px) {
.local-list {
display: grid;
grid-template-columns: repeat(2, minmax(0, 1fr));
}
}
@media (prefers-reduced-motion: reduce) {
.local-row__link:hover {
translate: none;
}
}
/* ------------------------------------------------------------ empty state */
.empty {
margin-top: var(--space-4);