create-lupine 1.0.31 → 1.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (126) hide show
  1. package/README.md +25 -0
  2. package/index.js +11 -9
  3. package/package.json +1 -1
  4. package/templates/common/.agents/skills/lupine-framework/SKILL.md +63 -0
  5. package/templates/common/.agents/skills/lupine-framework/references/backend-api.md +98 -0
  6. package/templates/common/.agents/skills/lupine-framework/references/icon-handling.md +71 -0
  7. package/templates/common/.agents/skills/lupine-framework/references/mobile-interactions.md +100 -0
  8. package/templates/common/.agents/skills/lupine-framework/references/native-apps.md +167 -0
  9. package/templates/common/.agents/skills/lupine-framework/references/navigation-and-routing.md +54 -0
  10. package/templates/common/.agents/skills/lupine-framework/references/reactivity-and-state.md +108 -0
  11. package/templates/common/.agents/skills/lupine-framework/references/styling-and-themes.md +119 -0
  12. package/templates/common/_env +2 -0
  13. package/templates/lupine-template-cv-starter/README.md +5 -0
  14. package/templates/lupine-template-cv-starter/web/src/index.tsx +1 -10
  15. package/templates/lupine-template-cv-starter/web/src/lupine-template-cv-starter/index.tsx +1 -10
  16. package/templates/lupine-template-doc-starter/README.md +5 -0
  17. package/templates/lupine-template-doc-starter/web/src/index.tsx +1 -10
  18. package/templates/lupine-template-doc-starter/web/src/lupine-template-doc-starter/index.tsx +1 -10
  19. package/templates/lupine-template-fullstack-starter/README.md +21 -0
  20. package/templates/lupine-template-fullstack-starter/api/package.json +10 -0
  21. package/templates/lupine-template-fullstack-starter/api/resources/install.mysql.sql +107 -0
  22. package/templates/lupine-template-fullstack-starter/api/resources/install.sqlite.sql +75 -0
  23. package/templates/lupine-template-fullstack-starter/api/src/lang/api-lang-en.ts +39 -0
  24. package/templates/lupine-template-fullstack-starter/api/src/lang/api-lang-zh-cn.ts +37 -0
  25. package/templates/lupine-template-fullstack-starter/api/src/service/admin-api.ts +139 -0
  26. package/templates/lupine-template-fullstack-starter/api/src/service/api.ts +111 -0
  27. package/templates/lupine-template-fullstack-starter/api/src/service/contact-api.ts +50 -0
  28. package/templates/lupine-template-fullstack-starter/api/src/service/file-api-base.ts +30 -0
  29. package/templates/lupine-template-fullstack-starter/api/src/service/root-api.ts +28 -0
  30. package/templates/lupine-template-fullstack-starter/api/src/service/send-email.ts +47 -0
  31. package/templates/lupine-template-fullstack-starter/api/src/service/setting-api.ts +60 -0
  32. package/templates/lupine-template-fullstack-starter/api/src/service/user-api.ts +1041 -0
  33. package/templates/{lupine-template-hello-world → lupine-template-fullstack-starter}/lupine.json +10 -1
  34. package/templates/lupine-template-fullstack-starter/web/assets/android-chrome-192x192.png +0 -0
  35. package/templates/lupine-template-fullstack-starter/web/assets/apple-touch-icon.png +0 -0
  36. package/templates/lupine-template-fullstack-starter/web/assets/favicon-16x16.png +0 -0
  37. package/templates/lupine-template-fullstack-starter/web/assets/favicon-32x32.png +0 -0
  38. package/templates/lupine-template-fullstack-starter/web/assets/icons-font/License-carbon-icons.txt +71 -0
  39. package/templates/lupine-template-fullstack-starter/web/assets/icons-font/License-material-design.txt +20 -0
  40. package/templates/lupine-template-fullstack-starter/web/assets/icons-font/i-font.woff2 +0 -0
  41. package/templates/lupine-template-fullstack-starter/web/assets/icons-font/sample.html +124 -0
  42. package/templates/lupine-template-fullstack-starter/web/assets/icons-font/style.css +103 -0
  43. package/templates/lupine-template-fullstack-starter/web/assets/images/sample.png +0 -0
  44. package/templates/lupine-template-fullstack-starter/web/assets/lupine-flower.png +0 -0
  45. package/templates/lupine-template-fullstack-starter/web/assets/lupine.svg +71 -0
  46. package/templates/lupine-template-fullstack-starter/web/assets/site.webmanifest +14 -0
  47. package/templates/lupine-template-fullstack-starter/web/icons-font.config.js +129 -0
  48. package/templates/{lupine-template-hello-world → lupine-template-fullstack-starter}/web/package.json +1 -1
  49. package/templates/lupine-template-fullstack-starter/web/src/admin_dev/admin-about.tsx +16 -0
  50. package/templates/lupine-template-fullstack-starter/web/src/admin_dev/admin-patch.ts +22 -0
  51. package/templates/lupine-template-fullstack-starter/web/src/admin_dev/index.html +22 -0
  52. package/templates/lupine-template-fullstack-starter/web/src/admin_dev/index.tsx +64 -0
  53. package/templates/lupine-template-fullstack-starter/web/src/components/footer-menu.tsx +52 -0
  54. package/templates/lupine-template-fullstack-starter/web/src/components/footer.tsx +15 -0
  55. package/templates/lupine-template-fullstack-starter/web/src/components/header.tsx +75 -0
  56. package/templates/lupine-template-fullstack-starter/web/src/components/home-search-component.tsx +132 -0
  57. package/templates/lupine-template-fullstack-starter/web/src/components/login-code-zh.tsx +162 -0
  58. package/templates/lupine-template-fullstack-starter/web/src/components/login-code.tsx +165 -0
  59. package/templates/lupine-template-fullstack-starter/web/src/components/login-zh.tsx +118 -0
  60. package/templates/lupine-template-fullstack-starter/web/src/components/login.tsx +122 -0
  61. package/templates/lupine-template-fullstack-starter/web/src/components/not-found-page.tsx +12 -0
  62. package/templates/lupine-template-fullstack-starter/web/src/components/register-zh.tsx +161 -0
  63. package/templates/lupine-template-fullstack-starter/web/src/components/register.tsx +163 -0
  64. package/templates/lupine-template-fullstack-starter/web/src/components/reset-password-zh.tsx +166 -0
  65. package/templates/lupine-template-fullstack-starter/web/src/components/reset-password.tsx +177 -0
  66. package/templates/lupine-template-fullstack-starter/web/src/components/story-card.tsx +96 -0
  67. package/templates/lupine-template-fullstack-starter/web/src/components/story-list.tsx +106 -0
  68. package/templates/lupine-template-fullstack-starter/web/src/components/story-props.ts +34 -0
  69. package/templates/lupine-template-fullstack-starter/web/src/components/user-info.tsx +84 -0
  70. package/templates/lupine-template-fullstack-starter/web/src/frames/admin-page-frame.tsx +48 -0
  71. package/templates/lupine-template-fullstack-starter/web/src/frames/frame1-page-frame.tsx +61 -0
  72. package/templates/lupine-template-fullstack-starter/web/src/frames/frame2-page-frame.tsx +61 -0
  73. package/templates/lupine-template-fullstack-starter/web/src/frames/top-frame.tsx +23 -0
  74. package/templates/lupine-template-fullstack-starter/web/src/frames/user-page-frame.tsx +90 -0
  75. package/templates/{lupine-template-hello-world → lupine-template-fullstack-starter}/web/src/index.html +6 -0
  76. package/templates/lupine-template-fullstack-starter/web/src/index.tsx +155 -0
  77. package/templates/lupine-template-fullstack-starter/web/src/models/client-env-keys.ts +5 -0
  78. package/templates/lupine-template-fullstack-starter/web/src/models/index.ts +15 -0
  79. package/templates/lupine-template-fullstack-starter/web/src/pages/admin-cfg.tsx +140 -0
  80. package/templates/lupine-template-fullstack-starter/web/src/pages/admin-item-edit.tsx +21 -0
  81. package/templates/lupine-template-fullstack-starter/web/src/pages/admin-item-list.tsx +24 -0
  82. package/templates/lupine-template-fullstack-starter/web/src/pages/admin-user.tsx +150 -0
  83. package/templates/lupine-template-fullstack-starter/web/src/pages/contact.tsx +105 -0
  84. package/templates/lupine-template-fullstack-starter/web/src/pages/page1-page.tsx +38 -0
  85. package/templates/lupine-template-fullstack-starter/web/src/pages/page2-page.tsx +38 -0
  86. package/templates/lupine-template-fullstack-starter/web/src/pages/user-favorite-page.tsx +58 -0
  87. package/templates/lupine-template-fullstack-starter/web/src/pages/user-home-page.tsx +27 -0
  88. package/templates/lupine-template-fullstack-starter/web/src/pages/user-mine-page.tsx +54 -0
  89. package/templates/lupine-template-fullstack-starter/web/src/pages/user-profile-page-zh.tsx +112 -0
  90. package/templates/lupine-template-fullstack-starter/web/src/pages/user-profile-page.tsx +112 -0
  91. package/templates/lupine-template-fullstack-starter/web/src/pages/user1-page.tsx +57 -0
  92. package/templates/lupine-template-fullstack-starter/web/src/services/fetch-data.ts +55 -0
  93. package/templates/lupine-template-fullstack-starter/web/src/services/shared-data.ts +19 -0
  94. package/templates/lupine-template-fullstack-starter/web/src/styles/base-css.ts +17 -0
  95. package/templates/{lupine-template-hello-world → lupine-template-fullstack-starter}/web/src/styles/global.css +10 -57
  96. package/templates/{lupine-template-hello-world → lupine-template-fullstack-starter}/web/src/styles/theme.ts +3 -1
  97. package/templates/lupine-template-responsive-starter/README.md +7 -0
  98. package/templates/lupine-template-responsive-starter/web/src/components/input-history-component.tsx +1 -1
  99. package/templates/lupine-template-responsive-starter/web/src/components/mine-about-page.tsx +2 -1
  100. package/templates/lupine-template-responsive-starter/web/src/components/mine-premium-page.tsx +2 -1
  101. package/templates/lupine-template-responsive-starter/web/src/components/mine-settings-page.tsx +8 -17
  102. package/templates/lupine-template-responsive-starter/web/src/components/mobile-top-search-menu.tsx +15 -27
  103. package/templates/lupine-template-responsive-starter/web/src/components/note-detail.tsx +2 -8
  104. package/templates/lupine-template-responsive-starter/web/src/components/note-edit.tsx +26 -36
  105. package/templates/lupine-template-responsive-starter/web/src/components/note-search-page.tsx +16 -21
  106. package/templates/lupine-template-responsive-starter/web/src/components/search-input.tsx +9 -9
  107. package/templates/lupine-template-responsive-starter/web/src/components/side-menu-content.tsx +3 -16
  108. package/templates/lupine-template-responsive-starter/web/src/frames/app-responsive-frame.tsx +3 -2
  109. package/templates/lupine-template-responsive-starter/web/src/index.tsx +2 -11
  110. package/templates/lupine-template-responsive-starter/web/src/lupine-template-responsive-starter/index.tsx +1 -10
  111. package/templates/lupine-template-responsive-starter/web/src/pages/about-page.tsx +3 -14
  112. package/templates/lupine-template-responsive-starter/web/src/pages/finance-page.tsx +3 -14
  113. package/templates/lupine-template-responsive-starter/web/src/pages/home-page.tsx +7 -15
  114. package/templates/lupine-template-responsive-starter/web/src/pages/mine-page.tsx +7 -14
  115. package/templates/lupine-template-responsive-starter/web/src/pages/tools-page.tsx +3 -14
  116. package/templates/lupine-template-responsive-starter/web/src/styles/theme.ts +2 -1
  117. package/templates/common/AI_CONTEXT.md +0 -1002
  118. package/templates/lupine-template-hello-world/api/package.json +0 -6
  119. package/templates/lupine-template-hello-world/api/resources/install.sqlite.sql +0 -4
  120. package/templates/lupine-template-hello-world/api/src/service/root-api.ts +0 -18
  121. package/templates/lupine-template-hello-world/web/src/index.tsx +0 -73
  122. package/templates/lupine-template-hello-world/web/src/styles/base-css.ts +0 -1
  123. /package/templates/{lupine-template-hello-world → lupine-template-fullstack-starter}/api/resources/config_default.json +0 -0
  124. /package/templates/{lupine-template-hello-world → lupine-template-fullstack-starter}/api/src/index.ts +0 -0
  125. /package/templates/{lupine-template-hello-world → lupine-template-fullstack-starter}/web/assets/favicon.ico +0 -0
  126. /package/templates/{lupine-template-hello-world → lupine-template-fullstack-starter}/web/src/styles/app.css +0 -0
@@ -0,0 +1,129 @@
1
+ /*
2
+ Define icons for generating fonts
3
+
4
+ Suggestions:
5
+ 1, use WOFF2 for major browsers except IE;
6
+ Or: 2, use WOFF for major browsers and IE 9~, Edge 12~
7
+ All 1, 2 need this code in HTML: `<i class="ifc-icon icon_name"></i>`
8
+ */
9
+
10
+ var path = require('path');
11
+ var cssTemplate = `
12
+ /*font-face*/
13
+ .ifc-box {
14
+ display: inline-flex;
15
+ position: relative;
16
+ border-radius: 3px;
17
+ text-align: center;
18
+ vertical-align: middle;
19
+ border: solid 1px #00f;
20
+ width: 40px;
21
+ height: 40px;
22
+ font-size: 20px;
23
+ color: blue;
24
+ margin: 5px;
25
+ }
26
+
27
+ .ifc-icon {
28
+ font-size: inherit;
29
+ display: inline-block;
30
+ font-family: '#font-family#';
31
+ font-style: normal;
32
+ font-weight: 400;
33
+ font-variant: normal;
34
+ text-transform: none;
35
+ text-rendering: auto;
36
+ line-height: 1em;
37
+ vertical-align: middle;
38
+ text-align: center;
39
+ text-decoration: inherit;
40
+ -moz-osx-font-smoothing: grayscale;
41
+ -webkit-font-smoothing: antialiased;
42
+ margin: auto;
43
+ }
44
+
45
+ /*
46
+ <div class='ifc-over-box'>
47
+ <i class='ifc-icon ma-refresh'></i>
48
+ <i class='ifc-icon ma-play ifc-over'></i>
49
+ </div>
50
+ */
51
+ .ifc-over-box {
52
+ display: flex;
53
+ position: relative;
54
+ width: min-content;
55
+ }
56
+
57
+ .ifc-over {
58
+ position: absolute;
59
+ left: 50%;
60
+ top: 50%;
61
+ font-size: 60%;
62
+ z-index: 1;
63
+ color: red;
64
+ transform: translate(-50%, -50%);
65
+ }
66
+
67
+ /* Animation for spinners */
68
+ .ifc-spin {
69
+ animation: ifc-spin-f 2s infinite linear;
70
+ display: inline-block;
71
+ }
72
+ /* @keyframes for IE10~ and major browsers */
73
+ @keyframes ifc-spin-f {
74
+ 0% {
75
+ transform: rotate(0deg);
76
+ }
77
+ 100% {
78
+ transform: rotate(359deg);
79
+ }
80
+ }
81
+
82
+ /*icons-css*/
83
+ `;
84
+
85
+ var htmlTemplate = `
86
+ <!DOCTYPE html><html><head>
87
+ <title>icons-font-customization sample</title>
88
+ <link rel="stylesheet" type="text/css" href="style.css">
89
+ </head><body><div class="sample">
90
+ #icons-html#</div></body></html>
91
+ `;
92
+
93
+ module.exports = {
94
+ fontName: 'i-font',
95
+ outputPath: path.join(__dirname, 'assets/icons-font/'),
96
+ outputName: 'i-font', // automatically add font extension to it
97
+ startChar: 10000, // unicode start number
98
+ svgicons2svgfont: {
99
+ fontHeight: 1024,
100
+ },
101
+ icons: [
102
+ // copy svg from icons-font-customization locally or remotely
103
+ {
104
+ path: 'material-design/svg/theme-light-dark.svg',
105
+ name: 'ma-theme-light-dark',
106
+ },
107
+ { path: 'font-awesome/brands/apple.svg', name: 'fa-apple' },
108
+ { path: 'font-awesome/brands/android.svg', name: 'fa-android' },
109
+ { path: 'carbon-icons/svg/app-services.svg', name: 'cb-app-services' },
110
+ { path: 'unicons/line/16-plus.svg', name: 'un-16-plus' },
111
+ { path: 'ant-design-icons/outlined/drag.svg', name: 'at-drag' },
112
+ // or add local svg files
113
+ // { path: '../src/asset/icons/pin.svg', name: 'my-pin', iconsRoot: __dirname },
114
+ ],
115
+ fontType: {
116
+ woff2: true,
117
+ woff: false,
118
+ ttf: false,
119
+ eot: false,
120
+ svg: false,
121
+ },
122
+ cssTemplate: cssTemplate,
123
+ htmlTemplate: htmlTemplate,
124
+ };
125
+
126
+ // Or pass parameters
127
+ var parameters = { '--config': path.join(__dirname, 'icons-font.config.js') };
128
+ var cmd = require('icons-font-command');
129
+ cmd.IconsFontLite.generateFont(parameters);
@@ -1,5 +1,5 @@
1
1
  {
2
- "name": "hello-world-web",
2
+ "name": "lupine-template-fullstack-starter-web",
3
3
  "version": "1.0.0",
4
4
  "dependencies": {},
5
5
  "devDependencies": {}
@@ -0,0 +1,16 @@
1
+ import { CssProps } from 'lupine.web';
2
+
3
+ export const AdminAboutPage = () => {
4
+ const css: CssProps = {};
5
+
6
+ return (
7
+ <div css={css} class='admin-about-top'>
8
+ <div class='row-box h2'>About this application</div>
9
+ <div class=''>
10
+ <li>lupine.web</li>
11
+ <li>lupine.web.components</li>
12
+ <li>lupine.api</li>
13
+ </div>
14
+ </div>
15
+ );
16
+ };
@@ -0,0 +1,22 @@
1
+ import { adminFrameHelper } from 'lupine.api/admin';
2
+ import { AdminAboutPage } from './admin-about';
3
+ import { clearCookie } from 'lupine.web';
4
+ import { userCookieName } from '../models';
5
+
6
+ export const patchAdminFrame = () => {
7
+ const aboutItem = adminFrameHelper.getSubMenuItem('help', 'about');
8
+ if (aboutItem) {
9
+ aboutItem.js = () => adminFrameHelper.addPanel('About', AdminAboutPage());
10
+ }
11
+
12
+ adminFrameHelper.setAppAdminHookCheckLogin(async (authResponse: any) => {
13
+ if (authResponse && authResponse.user && authResponse.user.admin === '1') {
14
+ return true;
15
+ }
16
+ return false;
17
+ });
18
+ adminFrameHelper.setAppAdminHookLogout(async () => {
19
+ clearCookie(userCookieName, '/');
20
+ clearCookie('_token', '/');
21
+ });
22
+ };
@@ -0,0 +1,22 @@
1
+ <!DOCTYPE html>
2
+ <html data-theme="<!--META-THEME-->">
3
+ <head>
4
+ <meta charset="utf-8" />
5
+ <link rel="manifest" href="/assets/site.webmanifest" />
6
+ <title><!--META-TITLE--></title>
7
+ <link rel="apple-touch-icon" sizes="180x180" href="/assets/apple-touch-icon.png" />
8
+ <link rel="icon" type="image/png" sizes="32x32" href="/assets/favicon-32x32.png" />
9
+ <link rel="icon" type="image/png" sizes="16x16" href="/assets/favicon-16x16.png" />
10
+ <link rel="icon" type="image/png" sizes="192x192" href="/assets/android-chrome-192x192.png" />
11
+ <meta name="viewport" content="width=device-width, initial-scale=1" />
12
+ <!--META-ENV-START-->
13
+ <!--META-ENV-END-->
14
+ <link rel="shortcut icon" href="/assets/favicon.ico?t={hash}" type="image/x-icon" />
15
+ <link rel="stylesheet" type="text/css" href="/assets/icons-font/style.css?t={hash}" />
16
+ <link rel="stylesheet" type="text/css" href="{SUBDIR}/index.css?t={hash}" />
17
+ <script defer src="{SUBDIR}/index.js?t={hash}"></script>
18
+ </head>
19
+ <body>
20
+ <div class="lupine-root"></div>
21
+ </body>
22
+ </html>
@@ -0,0 +1,64 @@
1
+ // css order is important
2
+ import '../styles/global.css';
3
+ import '../styles/app.css';
4
+
5
+ import { adminFrameHelper, devAdminPageRouter } from 'lupine.api/admin';
6
+ import {
7
+ bindAppGlobalStyle,
8
+ bindRenderPageFunctions,
9
+ bindRouter,
10
+ bindTheme,
11
+ debugWatch,
12
+ isFrontEnd,
13
+ PageProps,
14
+ PageRouter,
15
+ setDefaultPageTitle,
16
+ webEnv,
17
+ } from 'lupine.web';
18
+ import { demoPageRouter, Redirect } from 'lupine.web.components';
19
+ import { themes } from '../styles/theme';
20
+ import { baseCss } from '../styles/base-css';
21
+ import { baseUrl, fetchData } from '../services/fetch-data';
22
+ import { patchAdminFrame } from './admin-patch';
23
+ import { setCookieUser } from '../services/shared-data';
24
+ import { ClientEnvKeys } from '../models/client-env-keys';
25
+
26
+ if (isFrontEnd() && webEnv(ClientEnvKeys.NODE_ENV, '') === 'development') {
27
+ debugWatch(webEnv(ClientEnvKeys.API_PORT, 0));
28
+ }
29
+
30
+ export const checkDevAndAppAuth = async (props: PageProps) => {
31
+ adminFrameHelper.setIsDevAdmin(false);
32
+ if (typeof document === 'undefined') {
33
+ // no ssr for admin pages
34
+ return <div></div>;
35
+ }
36
+
37
+ // check dev admin
38
+ const data = await props.renderPageFunctions.fetchData('/api/admin/auth');
39
+ if (data && data.json && data.json.devLogin) {
40
+ adminFrameHelper.setIsDevAdmin(true);
41
+ return null;
42
+ }
43
+ if (data && data.json && data.json.appLogin && data.json.user) {
44
+ setCookieUser(data.json.user || {});
45
+ return null;
46
+ }
47
+ if (props.url !== '/admin_dev/login') {
48
+ return Redirect({ url: '/admin_dev/login' });
49
+ }
50
+ return null;
51
+ };
52
+ bindTheme('light', themes);
53
+ bindAppGlobalStyle('comm-css', baseCss, false, true);
54
+ setDefaultPageTitle('Sample - Page Title');
55
+
56
+ bindRenderPageFunctions({ fetchData, baseUrl });
57
+
58
+ patchAdminFrame();
59
+ const pageRouter = new PageRouter();
60
+ // devadmin and appadmin can access
61
+ devAdminPageRouter.setFilter(checkDevAndAppAuth);
62
+ pageRouter.use('/admin_dev/demo', demoPageRouter);
63
+ pageRouter.use('/admin_dev', devAdminPageRouter);
64
+ bindRouter(pageRouter);
@@ -0,0 +1,52 @@
1
+ import { CssProps } from 'lupine.web';
2
+ import { MediaQueryRange } from 'lupine.web.components';
3
+
4
+ export const FooterMenu = (props: any) => {
5
+ const css: CssProps = {
6
+ '.footer-menu': {
7
+ display: 'none',
8
+ position: 'fixed',
9
+ left: 0,
10
+ right: 0,
11
+ bottom: 0,
12
+ width: '100%',
13
+ background: 'var(--sidebar-bg-color)',
14
+ paddingBottom: 'env(safe-area-inset-bottom)',
15
+ zIndex: 'var(--layer-menu)',
16
+ height: '50px',
17
+ justifyContent: 'space-around',
18
+ alignItems: 'center',
19
+ borderTop: '1px solid #ccc',
20
+ },
21
+ '.footer-menu, .footer-menu a': {
22
+ textDecoration: 'none',
23
+ color: 'var(--sidebar-color)',
24
+ },
25
+ '.footer-menu .footer-menu-item': {
26
+ padding: '0 16px',
27
+ },
28
+ [MediaQueryRange.TabletBelow]: {
29
+ '.footer-menu': {
30
+ display: 'flex',
31
+ },
32
+ },
33
+ };
34
+ return (
35
+ <div css={css} class='footer-menu-box'>
36
+ <div class='footer-menu'>
37
+ <div class='footer-menu-item'>
38
+ <a href='/'>List</a>
39
+ </div>
40
+ <div class='footer-menu-item'>
41
+ <a href='/user/favorite'>Favorite</a>
42
+ </div>
43
+ <div class='footer-menu-item'>
44
+ <a href='/user/page1/parameter1/fixed-section/parameter2/option1'>Page1</a>
45
+ </div>
46
+ <div class='footer-menu-item'>
47
+ <a href='/user/mine'>Mine</a>
48
+ </div>
49
+ </div>
50
+ </div>
51
+ );
52
+ };
@@ -0,0 +1,15 @@
1
+ export const Footer = (props?: any) => {
2
+ const css: any = {
3
+ display: 'flex',
4
+ padding: '0 32px 16px',
5
+ '.footer-cp': {
6
+ padding: '1px 15px',
7
+ margin: 'auto',
8
+ },
9
+ };
10
+ return (
11
+ <div css={css} class={['footer-box', props.className].join(' ')}>
12
+ <div class='footer-cp'>{props.title}</div>
13
+ </div>
14
+ );
15
+ };
@@ -0,0 +1,75 @@
1
+ import { WebConfig } from 'lupine.web';
2
+ import { MediaQueryRange, MediaQueryMaxWidth, HtmlLoad } from 'lupine.web.components';
3
+ import { UserInfo } from './user-info';
4
+
5
+ export const Header = (props: { title: string; subtitle?: string }) => {
6
+ const css: any = {
7
+ display: 'flex',
8
+ width: '100%',
9
+ maxWidth: MediaQueryMaxWidth.DesktopMax,
10
+ margin: 'auto',
11
+ position: 'relative',
12
+ '.header-user': {
13
+ position: 'absolute',
14
+ right: '10px',
15
+ zIndex: 10,
16
+ },
17
+ '.logo-box': {
18
+ height: '100px',
19
+ width: '100px',
20
+ display: 'flex',
21
+ alignSelf: 'center',
22
+ },
23
+ '.logo': {
24
+ height: '100%',
25
+ padding: '1px',
26
+ margin: 'auto',
27
+ },
28
+ '.header-title': {
29
+ flex: '1',
30
+ fontSize: '38px',
31
+ textAlign: 'center',
32
+ // margin: '25px 0',
33
+ textShadow: '-3px -3px 10px white, 3px 3px 10px black',
34
+ color: 'darkblue',
35
+ },
36
+ '.header-subtitle': {
37
+ fontSize: '11px',
38
+ textAlign: 'center',
39
+ // margin: '25px 0',
40
+ // textShadow: '-3px -3px 10px white, 3px 3px 10px black',
41
+ // color: 'darkblue',
42
+ },
43
+ [MediaQueryRange.ExtraSmallBelow]: {
44
+ '.header-title, .header-subtitle': {
45
+ fontSize: '12px',
46
+ },
47
+ },
48
+ [MediaQueryRange.MobileBelow]: {
49
+ '.header-title': {
50
+ fontSize: '20px',
51
+ },
52
+ },
53
+ [MediaQueryRange.DesktopAbove]: {
54
+ '.header-title': {
55
+ fontSize: '50px',
56
+ },
57
+ },
58
+ };
59
+ return (
60
+ <div css={css} class='header-box'>
61
+ <div class='header-user'>
62
+ <UserInfo />
63
+ </div>
64
+ <div class='logo-box'>
65
+ <HtmlLoad
66
+ html={async () => <img class='logo' src={`/api/image/${await WebConfig.get('siteLogo', '(not set)')}`} />}
67
+ ></HtmlLoad>
68
+ </div>
69
+ <div class='header-title'>
70
+ {props.title}
71
+ <div class='header-subtitle pt-s'>{props.subtitle}</div>
72
+ </div>
73
+ </div>
74
+ );
75
+ };
@@ -0,0 +1,132 @@
1
+ import { createSignal, CssProps, initializePage, onMount } from 'lupine.web';
2
+ import { DragFresh, DragRefreshCloseProps, NotificationColor, NotificationMessage } from 'lupine.web.components';
3
+ import { StoryListComponent } from './story-list';
4
+ import { StoryCardShortProps } from './story-props';
5
+
6
+ export const getMusicList = async (management: boolean) => {
7
+ // const result = await getRenderPageProps().renderPageFunctions.fetchData('/api/music-list');
8
+ // console.log('====getMusicList', result);
9
+ // if (!result.json || result.json.status !== 'ok') {
10
+ // // NoticeMessage.sendMessage('Failed to get user info.', NotificationColor.Error);
11
+ // return null;
12
+ // }
13
+ return {
14
+ count: 100,
15
+ management,
16
+ results: Array.from({ length: 100 }).map(
17
+ (_, index) =>
18
+ ({
19
+ id: index + 1,
20
+ title: `Title ${index + 1}`,
21
+ cover_file: `/assets/images/sample.png`,
22
+ author: `Author ${index + 1}`,
23
+ view_count: 100 + index,
24
+ download_count: 50 + index,
25
+ collect_count: 30 + index,
26
+ start_time_seconds: new Date().getTime() / 1000,
27
+ } as StoryCardShortProps)
28
+ ),
29
+ };
30
+ };
31
+
32
+ export type SearchMusicProps = {
33
+ management: boolean;
34
+ };
35
+ export const HomeSearchComponent = (props: SearchMusicProps) => {
36
+ const css: CssProps = {
37
+ display: 'flex',
38
+ // paddingTop: '4px',
39
+ // paddingRight: '8px',
40
+ flexDirection: 'column',
41
+ alignItems: 'center',
42
+ width: '100%',
43
+ '.search-result-box': {
44
+ width: '100%',
45
+ },
46
+ '.navigation-bar-box': {
47
+ width: '100%',
48
+ height: '20px',
49
+ position: 'relative',
50
+ marginBottom: '16px',
51
+ // textAlign: 'center',
52
+ },
53
+ '.navigation-bar': {
54
+ position: 'absolute',
55
+ top: '0',
56
+ left: '0',
57
+ width: '100%',
58
+ display: 'flex',
59
+ whiteSpace: 'nowrap',
60
+ overflowX: 'auto',
61
+ scrollbarWidth: 'none',
62
+ // justifyContent: 'center',
63
+ // textAlign: 'left',
64
+ },
65
+ // '.navigation-bar:has(scrollbar), .navigation-bar::-webkit-scrollbar': {
66
+ // justifyContent: 'flex-start',
67
+ // },
68
+ '.navigation-item': {
69
+ padding: '6px 10px',
70
+ borderRadius: '12px',
71
+ cursor: 'pointer',
72
+ '&:hover': {
73
+ backgroundColor: '#f0f0f0',
74
+ },
75
+ },
76
+ '.navigation-item.active': {
77
+ backgroundColor: '#f0f0f0',
78
+ fontWeight: 600,
79
+ },
80
+ };
81
+
82
+ const [dom, setDom] = createSignal<any>('');
83
+ onMount(() => onSearch());
84
+ const onSearch = async () => {
85
+ const result = await getMusicList(props.management);
86
+ setDom(
87
+ <div>
88
+ {result.count > 0 ? (
89
+ <StoryListComponent items={result.results} count={result.count} management={props.management} />
90
+ ) : (
91
+ 'no result'
92
+ )}
93
+ </div>
94
+ );
95
+ };
96
+ const onAdd = () => {
97
+ initializePage('/management-new');
98
+ };
99
+ const onDragRefresh = async (close: DragRefreshCloseProps) => {
100
+ NotificationMessage.sendMessage('Refreshing...', NotificationColor.Info);
101
+ await onSearch();
102
+ close();
103
+ };
104
+ return (
105
+ <div css={css} class='search-music-box'>
106
+ <DragFresh container='.search-music-box' onDragRefresh={onDragRefresh} />
107
+ <div className='row-box search-box m-auto p-m w-100p'>
108
+ <input class='input-base txt-search flex-1' type='text' placeholder='Please input keywords' />
109
+ <button class='button-base btn-search' onClick={onSearch}>
110
+ Search
111
+ </button>
112
+ {props.management && (
113
+ <button class='button-base btn-add ml-m' onClick={onAdd}>
114
+ Add
115
+ </button>
116
+ )}
117
+ </div>
118
+ <div class='navigation-bar-box mt-m'>
119
+ <div class='navigation-bar'>
120
+ <div class='navigation-item active'>All</div>
121
+ <div class='navigation-item'>Chinese</div>
122
+ <div class='navigation-item'>Europe</div>
123
+ <div class='navigation-item'>Asia</div>
124
+ <div class='navigation-item'>Dimension</div>
125
+ <div class='navigation-item'>Ancient</div>
126
+ <div class='navigation-item'>Simple</div>
127
+ </div>
128
+ </div>
129
+ <div class='search-result-box'>{dom}</div>
130
+ </div>
131
+ );
132
+ };