Changeset 0.37.16 (#228)

This commit is contained in:
2026-03-24 11:46:13 +00:00
parent d005e8a30f
commit e0687d2ea6
19 changed files with 2900 additions and 13 deletions

View File

@@ -124,12 +124,18 @@ type TeamAdminPageData struct {
Section string `json:"section"`
}
// ProjectsPageData is what the projects surface receives.
type ProjectsPageData struct {
ProjectID string `json:"project_id"`
}
func (e *Engine) registerLoaders() {
e.RegisterLoader("admin", e.adminLoader)
e.RegisterLoader("chat", e.chatLoader)
e.RegisterLoader("notes", e.notesLoader)
e.RegisterLoader("settings", e.settingsLoader)
e.RegisterLoader("team-admin", e.teamAdminLoader)
e.RegisterLoader("projects", e.projectsLoader)
}
// ListDataProviders returns the keys of all registered data providers.
@@ -431,3 +437,8 @@ func (e *Engine) settingsLoader(c *gin.Context, s store.Stores) (any, error) {
return data, nil
}
func (e *Engine) projectsLoader(c *gin.Context, s store.Stores) (any, error) {
projectID := c.Param("id")
return &ProjectsPageData{ProjectID: projectID}, nil
}

View File

@@ -237,6 +237,12 @@ func (e *Engine) registerCoreSurfaces() {
DataRequires: []string{"team-admin"},
Layout: "single", Source: "core",
},
{
ID: "projects", Route: "/projects/:id", AltRoutes: []string{"/projects"},
Title: "Projects", Template: "surface-projects", Auth: "authenticated",
DataRequires: []string{"projects"},
Layout: "single", Source: "core",
},
{
ID: "workflow", Route: "/w/:id",
Title: "Workflow", Template: "workflow", Auth: "session",

View File

@@ -27,6 +27,7 @@
<link rel="stylesheet" href="{{.BasePath}}/css/sw-shell.css?v={{.Version}}">
{{if eq .Surface "chat"}}{{template "css-chat" .}}{{end}}
{{if eq .Surface "notes"}}{{template "css-notes" .}}{{end}}
{{if eq .Surface "projects"}}{{template "css-projects" .}}{{end}}
{{/* v0.27.0: Extension surface CSS — loaded from /surfaces/{id}/css/main.css */}}
{{if and .Manifest (eq .Manifest.Source "extension")}}
<link rel="stylesheet" href="{{.BasePath}}/surfaces/{{.Surface}}/css/main.css?v={{.Version}}">
@@ -96,6 +97,7 @@
{{else if eq .Surface "team-admin"}}{{template "surface-team-admin" .}}
{{else if eq .Surface "notes"}}{{template "surface-notes" .}}
{{else if eq .Surface "settings"}}{{template "surface-settings" .}}
{{else if eq .Surface "projects"}}{{template "surface-projects" .}}
{{else if and .Manifest (eq .Manifest.Source "extension")}}{{template "surface-extension" .}}
{{else}}<div style="padding:20px">Unknown surface: {{.Surface}}</div>
{{end}}
@@ -132,6 +134,7 @@
{{if eq .Surface "team-admin"}}{{template "scripts-team-admin" .}}{{end}}
{{if eq .Surface "notes"}}{{template "scripts-notes" .}}{{end}}
{{if eq .Surface "settings"}}{{template "scripts-settings" .}}{{end}}
{{if eq .Surface "projects"}}{{template "scripts-projects" .}}{{end}}
{{/* v0.27.0: Extension surface JS — loaded from /surfaces/{id}/js/main.js */}}
{{if and .Manifest (eq .Manifest.Source "extension")}}
<script type="module" nonce="{{.CSPNonce}}" src="{{.BasePath}}/surfaces/{{.Surface}}/js/main.js?v={{.Version}}"></script>

View File

@@ -0,0 +1,32 @@
{{/*
Projects surface — v0.37.16: Card grid + detail with inline chat.
*/}}
{{define "surface-projects"}}
<div id="projects-mount" style="height:100%;overflow:hidden;"></div>
{{end}}
{{define "css-projects"}}
<link rel="stylesheet" href="{{.BasePath}}/css/sw-projects-surface.css?v={{.Version}}">
{{end}}
{{define "scripts-projects"}}
<script nonce="{{.CSPNonce}}">
window.__PROJECT_ID__ = '{{.Data.ProjectID}}';
</script>
<script type="module" nonce="{{.CSPNonce}}">
const { h, render } = await import('{{.BasePath}}/js/sw/vendor/preact.module.js');
const hooksModule = await import('{{.BasePath}}/js/sw/vendor/hooks.module.js');
const { default: htm } = await import('{{.BasePath}}/js/sw/vendor/htm.module.js');
const html = htm.bind(h);
window.preact = window.preact || { h, render };
window.hooks = window.hooks || hooksModule;
window.html = window.html || html;
const { boot } = await import('{{.BasePath}}/js/sw/sdk/index.js?v={{.Version}}');
await boot();
await import('{{.BasePath}}/js/sw/surfaces/projects/index.js?v={{.Version}}');
</script>
{{end}}