Skip to content

Commit ce003da

Browse files
committed
feat: add page layouts for chat, video, music, news, product, cart, order ...
1 parent d0fa84d commit ce003da

44 files changed

Lines changed: 5668 additions & 1286 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎.gitignore‎

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,26 @@
11
node_modules/
2+
*/node_modules/
3+
*/*/node_modules/
24
dist/
5+
*/dist/
6+
*/*/dist/
7+
dist-*/
8+
*/dist-*/
9+
*/*/dist-*/
310
.env
411
.env.local
512
*.log
613
.DS_Store
14+
*/.DS_Store
15+
*/*/.DS_Store
716
.a2api/
817
coverage/
918
apps/chat-demo/data/*.jsonl
19+
.idea
20+
/.idea
21+
*/.idea
22+
*/*/.idea
23+
/apps/admin/dist-client
24+
/apps/admin/dist-server
25+
/apps/chat-demo/dist-client
26+
/apps/chat-demo/dist-server

‎README.en.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ export APIJSON_BASE_URL=http://localhost:8080
105105
# or edit .env
106106
```
107107

108-
Ensure the Demo schema (User / Moment / Comment) is available on that server.
108+
Ensure the Demo schema is available on that server. Business layout tables are in `apps/chat-demo/sql/layout_demo_tables.sql` (User / Moment / Comment plus Employee, Activity, Message, News, Notice, Blog, Article, Video, Music, Product, …). After import, reload Access/Request.
109109

110110
**Writes (POST/PUT/DELETE):** the Demo often requires a logged-in session (`@role` OWNER/LOGIN). The MVP still generates the request and shows the HITL Approve/Reject UI; if APIJSON returns "not logged in", log in via your Demo/APIAuto session cookies or relax Access for local testing. **Reads** work out of the box against the public Demo data.
111111

‎README.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ export APIJSON_BASE_URL=http://localhost:8080
9393
# 或编辑 .env
9494
```
9595

96-
请确保 Demo 库表(User / Moment / Comment)在该服务上可用。
96+
请确保 Demo 库表在该服务上可用。业务表示例见 `apps/chat-demo/sql/layout_demo_tables.sql`(User / Moment / Comment 以及员工、活动、聊天、新闻、资讯、博客、文章、视频、音乐、商品等),导入后需重载 Access/Request。
9797

9898
**写操作(POST/PUT/DELETE):** Demo 常要求已登录会话(`@role` OWNER/LOGIN)。MVP 仍会生成请求并展示 HITL 批准/拒绝界面;若 APIJSON 返回未登录,请通过 Demo/APIAuto 会话 Cookie 登录,或在本地放宽 Access。**读操作**可直接使用公开 Demo 数据。
9999

‎apps/chat-demo/client/charts.ts‎

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -278,6 +278,14 @@ const KNOWN_NUMBER_METRICS: Record<string, string[]> = {
278278
Moment: ["commentCount"],
279279
User: [],
280280
Comment: [],
281+
Employee: ["salary"],
282+
Activity: ["signupCount"],
283+
News: ["viewCount"],
284+
Video: ["duration", "playCount"],
285+
Music: ["duration", "playCount"],
286+
Product: ["price", "stock", "sales"],
287+
Cart: ["price", "qty"],
288+
ShopOrder: ["total"],
281289
};
282290

283291
const KNOWN_ARRAY_METRICS: Record<string, string[]> = {

‎apps/chat-demo/client/fk-expand.ts‎

Lines changed: 40 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,13 +22,24 @@ export type FkJoinSpec = {
2222
onField?: string;
2323
};
2424

25+
const USER_FK: FkEdge = { column: "userId", target: "User" };
26+
2527
/** Primary table → outgoing FK edges. */
2628
export const TABLE_FK_EDGES: Record<string, FkEdge[]> = {
27-
Moment: [{ column: "userId", target: "User" }],
28-
Comment: [
29-
{ column: "userId", target: "User" },
30-
{ column: "momentId", target: "Moment" },
31-
],
29+
Moment: [USER_FK],
30+
Comment: [USER_FK, { column: "momentId", target: "Moment" }],
31+
Employee: [USER_FK],
32+
Activity: [USER_FK],
33+
Message: [USER_FK, { column: "toUserId", target: "User" }],
34+
News: [USER_FK],
35+
Notice: [USER_FK],
36+
Blog: [USER_FK],
37+
Article: [USER_FK],
38+
Video: [USER_FK],
39+
Music: [USER_FK],
40+
Product: [USER_FK],
41+
Cart: [USER_FK, { column: "productId", target: "Product" }],
42+
ShopOrder: [USER_FK],
3243
};
3344

3445
/**
@@ -40,6 +51,18 @@ export const DEFAULT_FK_COLUMNS: Record<string, string[]> = {
4051
User: ["name", "tag", "head", "pictureList"],
4152
Moment: ["content"],
4253
Comment: ["content"],
54+
Employee: ["name", "dept", "head"],
55+
Activity: ["title", "cover"],
56+
Message: ["content", "author", "head"],
57+
News: ["title", "cover"],
58+
Notice: ["title", "cover"],
59+
Blog: ["title", "cover"],
60+
Article: ["title", "cover"],
61+
Video: ["title", "cover"],
62+
Music: ["title", "cover", "artist"],
63+
Product: ["name", "cover", "price"],
64+
Cart: ["title", "cover", "price"],
65+
ShopOrder: ["consignee", "total", "status"],
4366
};
4467

4568
/** Extra columns offered in the multi-select UI (beyond the default text field). */
@@ -63,6 +86,18 @@ export const FK_OPTIONAL_COLUMNS: Record<string, string[]> = {
6386
"pictureList",
6487
],
6588
Comment: ["id", "content", "userId", "momentId", "toId", "date"],
89+
Employee: ["id", "name", "dept", "title", "sex", "salary", "status", "head"],
90+
Activity: ["id", "title", "cover", "status", "startTime", "endTime"],
91+
Message: ["id", "content", "author", "head", "toUserId", "date"],
92+
News: ["id", "title", "cover", "source", "author", "date"],
93+
Notice: ["id", "title", "cover", "status", "date"],
94+
Blog: ["id", "title", "cover", "author", "date"],
95+
Article: ["id", "title", "cover", "author", "date"],
96+
Video: ["id", "title", "cover", "author", "videoUrl", "playCount"],
97+
Music: ["id", "title", "cover", "artist", "audioUrl", "playCount"],
98+
Product: ["id", "name", "cover", "price", "stock", "status"],
99+
Cart: ["id", "title", "cover", "price", "qty", "productId"],
100+
ShopOrder: ["id", "consignee", "phone", "address", "total", "status"],
66101
};
67102

68103
export function defaultFkColumns(table: string): string[] {

‎apps/chat-demo/client/i18n/locales/en.ts‎

Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,26 @@ export const en = {
2626
msgComments: "List comments",
2727
msgNewMoment: "Create moment",
2828
msgAddComment: "Create comment",
29+
employees: "Employees",
30+
campaigns: "Campaigns",
31+
messages: "Messages",
32+
news: "News",
33+
notices: "Notices",
34+
blogs: "Blogs",
35+
articles: "Articles",
36+
videos: "Videos",
37+
music: "Music",
38+
products: "Products",
39+
msgEmployees: "List employees",
40+
msgCampaigns: "List campaigns",
41+
msgMessages: "List chat messages",
42+
msgNews: "List news",
43+
msgNotices: "List notices",
44+
msgBlogs: "List blogs",
45+
msgArticles: "List articles",
46+
msgVideos: "List videos",
47+
msgMusic: "List music",
48+
msgProducts: "List products",
2949
placeholder: "e.g. List the latest 10 moments",
3050
send: "Send",
3151
},
@@ -206,6 +226,71 @@ export const en = {
206226
analyzeTitle: "AI analyzes this page and generates a report",
207227
pageZeroBased: "Page (0-based)",
208228
rowsPerPage: "Rows per page",
229+
selectLayout: "Page layout",
230+
},
231+
layout: {
232+
data: "Data",
233+
campaign: "Campaigns",
234+
social: "Social",
235+
chat: "Chat",
236+
news: "News",
237+
info: "Info",
238+
blog: "Blog",
239+
article: "Articles",
240+
video: "Video",
241+
music: "Music",
242+
commerce: "Shop",
243+
cart: "Cart",
244+
order: "Checkout",
245+
addToCart: "Add to cart",
246+
buyNow: "Buy now",
247+
addedToCart: "Added to cart",
248+
cartEmpty: "Cart is empty",
249+
checkout: "Checkout",
250+
placeOrder: "Place order",
251+
orderPlaced: "Order placed",
252+
consignee: "Name",
253+
phone: "Phone",
254+
address: "Address",
255+
remark: "Remark",
256+
stock: "Stock",
257+
play: "Play",
258+
pickTrack: "Choose a track",
259+
noMedia: "No media URL on this row",
260+
editFields: "Edit fields",
261+
hideFields: "Hide fields",
262+
subscribe: "Subscribe",
263+
like: "Like",
264+
dislike: "Dislike",
265+
share: "Share",
266+
save: "Save",
267+
related: "Up next",
268+
comments: "Comments",
269+
views: "views",
270+
plays: "plays",
271+
sold: "sold",
272+
lyrics: "Lyrics",
273+
queue: "Queue",
274+
nowPlaying: "Now playing",
275+
follow: "Follow",
276+
message: "Message",
277+
toc: "Contents",
278+
authorCard: "Author",
279+
articles: "Articles",
280+
fans: "Fans",
281+
reads: "Reads",
282+
signup: "Sign up",
283+
hotNews: "Headlines",
284+
relatedNews: "Related",
285+
description: "Description",
286+
specs: "Details",
287+
qty: "Qty",
288+
buyBox: "Buy",
289+
inStock: "In stock",
290+
outOfStock: "Out of stock",
291+
send: "Send",
292+
composerHint: "Message…",
293+
moreFrom: "More from this list",
209294
},
210295
result: {
211296
noMatching: "No matching records",

‎apps/chat-demo/client/i18n/locales/zh-CN.ts‎

Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,26 @@ export const zhCN: TranslationSchema = {
2828
msgComments: "列出评论",
2929
msgNewMoment: "创建动态",
3030
msgAddComment: "创建评论",
31+
employees: "员工",
32+
campaigns: "活动",
33+
messages: "聊天",
34+
news: "新闻",
35+
notices: "资讯",
36+
blogs: "博客",
37+
articles: "文章",
38+
videos: "视频",
39+
music: "音乐",
40+
products: "商品",
41+
msgEmployees: "列出员工",
42+
msgCampaigns: "列出运营活动",
43+
msgMessages: "列出聊天消息",
44+
msgNews: "列出新闻",
45+
msgNotices: "列出资讯",
46+
msgBlogs: "列出博客",
47+
msgArticles: "列出文章",
48+
msgVideos: "列出视频",
49+
msgMusic: "列出音乐",
50+
msgProducts: "列出商品",
3151
placeholder: "例如:列出最新 10 条动态",
3252
send: "发送",
3353
},
@@ -205,6 +225,71 @@ export const zhCN: TranslationSchema = {
205225
analyzeTitle: "用 AI 分析本页数据并生成报告",
206226
pageZeroBased: "页码(从 0 起)",
207227
rowsPerPage: "每页行数",
228+
selectLayout: "页面布局",
229+
},
230+
layout: {
231+
data: "数据管理",
232+
campaign: "运营活动",
233+
social: "社交",
234+
chat: "聊天",
235+
news: "新闻",
236+
info: "资讯",
237+
blog: "博客",
238+
article: "文章",
239+
video: "视频",
240+
music: "音乐",
241+
commerce: "电商",
242+
cart: "购物车",
243+
order: "下单页",
244+
addToCart: "加入购物车",
245+
buyNow: "立即购买",
246+
addedToCart: "已加入购物车",
247+
cartEmpty: "购物车是空的",
248+
checkout: "去结算",
249+
placeOrder: "提交订单",
250+
orderPlaced: "下单成功",
251+
consignee: "收货人",
252+
phone: "手机号",
253+
address: "地址",
254+
remark: "备注",
255+
stock: "库存",
256+
play: "播放",
257+
pickTrack: "选择曲目",
258+
noMedia: "该行没有可播放的媒体地址",
259+
editFields: "编辑字段",
260+
hideFields: "收起字段",
261+
subscribe: "订阅",
262+
like: "点赞",
263+
dislike: "不喜欢",
264+
share: "分享",
265+
save: "保存",
266+
related: "接下来播放",
267+
comments: "评论",
268+
views: "次观看",
269+
plays: "次播放",
270+
sold: "已售",
271+
lyrics: "歌词",
272+
queue: "播放队列",
273+
nowPlaying: "正在播放",
274+
follow: "关注",
275+
message: "私信",
276+
toc: "目录",
277+
authorCard: "作者",
278+
articles: "文章",
279+
fans: "粉丝",
280+
reads: "阅读",
281+
signup: "立即报名",
282+
hotNews: "要闻",
283+
relatedNews: "相关资讯",
284+
description: "商品介绍",
285+
specs: "规格参数",
286+
qty: "数量",
287+
buyBox: "购买",
288+
inStock: "有货",
289+
outOfStock: "缺货",
290+
send: "发送",
291+
composerHint: "发消息…",
292+
moreFrom: "本页其它内容",
208293
},
209294
result: {
210295
noMatching: "无匹配记录",

‎apps/chat-demo/client/index.html‎

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,16 @@
9292
<button type="button" data-i18n="chat.comments" data-i18n-msg="chat.msgComments" data-msg="List comments">Comments</button>
9393
<button type="button" data-i18n="chat.newMoment" data-i18n-msg="chat.msgNewMoment" data-msg="Create moment">New moment</button>
9494
<button type="button" data-i18n="chat.addComment" data-i18n-msg="chat.msgAddComment" data-msg="Create comment">Add Comment</button>
95+
<button type="button" data-i18n="chat.employees" data-i18n-msg="chat.msgEmployees" data-msg="List employees">Employees</button>
96+
<button type="button" data-i18n="chat.campaigns" data-i18n-msg="chat.msgCampaigns" data-msg="List campaigns">Campaigns</button>
97+
<button type="button" data-i18n="chat.messages" data-i18n-msg="chat.msgMessages" data-msg="List chat messages">Messages</button>
98+
<button type="button" data-i18n="chat.news" data-i18n-msg="chat.msgNews" data-msg="List news">News</button>
99+
<button type="button" data-i18n="chat.notices" data-i18n-msg="chat.msgNotices" data-msg="List notices">Notices</button>
100+
<button type="button" data-i18n="chat.blogs" data-i18n-msg="chat.msgBlogs" data-msg="List blogs">Blogs</button>
101+
<button type="button" data-i18n="chat.articles" data-i18n-msg="chat.msgArticles" data-msg="List articles">Articles</button>
102+
<button type="button" data-i18n="chat.videos" data-i18n-msg="chat.msgVideos" data-msg="List videos">Videos</button>
103+
<button type="button" data-i18n="chat.music" data-i18n-msg="chat.msgMusic" data-msg="List music">Music</button>
104+
<button type="button" data-i18n="chat.products" data-i18n-msg="chat.msgProducts" data-msg="List products">Products</button>
95105
</div>
96106
<form id="chat-form" class="chat-form">
97107
<input

0 commit comments

Comments
 (0)