create-lupine 1.0.28 → 1.0.30
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.
- package/index.js +410 -411
- package/package.json +17 -17
- package/templates/common/.env.development +7 -7
- package/templates/common/.env.mobile +9 -9
- package/templates/common/.env.production +7 -7
- package/templates/common/_env +58 -58
- package/templates/common/_gitignore +25 -25
- package/templates/common/apps/server/src/index.ts +78 -76
- package/templates/common/apps/server/src/server-env-keys.ts +0 -9
- package/templates/common/dev/cp-folder.js +45 -45
- package/templates/common/tsconfig.json +128 -128
- package/templates/lupine-template-cv-starter/api/package.json +5 -5
- package/templates/lupine-template-cv-starter/api/resources/config_default.json +6 -6
- package/templates/lupine-template-cv-starter/api/resources/install.sqlite.sql +3 -3
- package/templates/lupine-template-cv-starter/api/src/index.ts +15 -15
- package/templates/lupine-template-cv-starter/lupine.json +40 -38
- package/templates/lupine-template-cv-starter/web/markdown/en/01-experience/index.md +32 -32
- package/templates/lupine-template-cv-starter/web/markdown/en/02-projects/index.md +36 -36
- package/templates/lupine-template-cv-starter/web/markdown/en/03-skills/index.md +28 -28
- package/templates/lupine-template-cv-starter/web/markdown/en/04-education/index.md +16 -16
- package/templates/lupine-template-cv-starter/web/markdown/en/index.md +41 -41
- package/templates/lupine-template-cv-starter/web/markdown/index.md +7 -7
- package/templates/lupine-template-cv-starter/web/markdown/zh/01-experience/index.md +32 -32
- package/templates/lupine-template-cv-starter/web/markdown/zh/02-projects/index.md +36 -36
- package/templates/lupine-template-cv-starter/web/markdown/zh/03-skills/index.md +28 -28
- package/templates/lupine-template-cv-starter/web/markdown/zh/04-education/index.md +17 -17
- package/templates/lupine-template-cv-starter/web/markdown/zh/index.md +41 -41
- package/templates/lupine-template-cv-starter/web/package.json +5 -5
- package/templates/lupine-template-cv-starter/web/src/client-env-keys.ts +5 -5
- package/templates/lupine-template-cv-starter/web/src/index.html +16 -16
- package/templates/lupine-template-cv-starter/web/src/index.tsx +28 -28
- package/templates/lupine-template-cv-starter/web/src/lupine-template-cv-starter/404.html +38 -38
- package/templates/lupine-template-cv-starter/web/src/lupine-template-cv-starter/index.html +73 -73
- package/templates/lupine-template-cv-starter/web/src/lupine-template-cv-starter/index.tsx +30 -30
- package/templates/lupine-template-cv-starter/web/src/markdown-built/en/01-experience/index.html +20 -20
- package/templates/lupine-template-cv-starter/web/src/markdown-built/en/02-projects/index.html +28 -28
- package/templates/lupine-template-cv-starter/web/src/markdown-built/en/03-skills/index.html +18 -18
- package/templates/lupine-template-cv-starter/web/src/markdown-built/en/04-education/index.html +10 -10
- package/templates/lupine-template-cv-starter/web/src/markdown-built/en/index.html +20 -20
- package/templates/lupine-template-cv-starter/web/src/markdown-built/zh/01-experience/index.html +20 -20
- package/templates/lupine-template-cv-starter/web/src/markdown-built/zh/02-projects/index.html +28 -28
- package/templates/lupine-template-cv-starter/web/src/markdown-built/zh/03-skills/index.html +18 -18
- package/templates/lupine-template-cv-starter/web/src/markdown-built/zh/04-education/index.html +11 -11
- package/templates/lupine-template-cv-starter/web/src/markdown-built/zh/index.html +20 -20
- package/templates/lupine-template-cv-starter/web/src/styles/base-css.ts +15 -15
- package/templates/lupine-template-doc-starter/api/package.json +5 -5
- package/templates/lupine-template-doc-starter/api/resources/config_default.json +6 -6
- package/templates/lupine-template-doc-starter/api/resources/install.sqlite.sql +3 -3
- package/templates/lupine-template-doc-starter/api/src/index.ts +15 -15
- package/templates/lupine-template-doc-starter/api/src/resources/config_default.json +6 -6
- package/templates/lupine-template-doc-starter/api/src/resources/install.sqlite.sql +3 -3
- package/templates/lupine-template-doc-starter/lupine.json +40 -38
- package/templates/lupine-template-doc-starter/web/markdown/en/essentials/index.md +6 -6
- package/templates/lupine-template-doc-starter/web/markdown/en/essentials/list.md +18 -18
- package/templates/lupine-template-doc-starter/web/markdown/en/guide/install.md +18 -18
- package/templates/lupine-template-doc-starter/web/markdown/en/guide/started.md +22 -22
- package/templates/lupine-template-doc-starter/web/markdown/en/index.md +42 -42
- package/templates/lupine-template-doc-starter/web/markdown/index.md +7 -7
- package/templates/lupine-template-doc-starter/web/markdown/zh/essentials/index.md +6 -6
- package/templates/lupine-template-doc-starter/web/markdown/zh/essentials/list.md +18 -18
- package/templates/lupine-template-doc-starter/web/markdown/zh/guide/install.md +18 -18
- package/templates/lupine-template-doc-starter/web/markdown/zh/guide/started.md +22 -22
- package/templates/lupine-template-doc-starter/web/markdown/zh/index.md +42 -42
- package/templates/lupine-template-doc-starter/web/package.json +5 -5
- package/templates/lupine-template-doc-starter/web/src/client-env-keys.ts +5 -5
- package/templates/lupine-template-doc-starter/web/src/index.html +16 -16
- package/templates/lupine-template-doc-starter/web/src/index.tsx +28 -28
- package/templates/lupine-template-doc-starter/web/src/lupine-template-doc-starter/404.html +38 -38
- package/templates/lupine-template-doc-starter/web/src/lupine-template-doc-starter/index.html +27 -27
- package/templates/lupine-template-doc-starter/web/src/lupine-template-doc-starter/index.tsx +30 -30
- package/templates/lupine-template-doc-starter/web/src/markdown-built/en/essentials/list.html +8 -8
- package/templates/lupine-template-doc-starter/web/src/markdown-built/en/guide/install.html +8 -8
- package/templates/lupine-template-doc-starter/web/src/markdown-built/en/guide/started.html +12 -12
- package/templates/lupine-template-doc-starter/web/src/markdown-built/zh/essentials/list.html +8 -8
- package/templates/lupine-template-doc-starter/web/src/markdown-built/zh/guide/install.html +8 -8
- package/templates/lupine-template-doc-starter/web/src/markdown-built/zh/guide/started.html +12 -12
- package/templates/lupine-template-doc-starter/web/src/styles/base-css.ts +15 -15
- package/templates/lupine-template-hello-world/api/resources/install.sqlite.sql +3 -3
- package/templates/lupine-template-hello-world/api/src/index.ts +4 -4
- package/templates/lupine-template-hello-world/api/src/service/root-api.ts +18 -18
- package/templates/lupine-template-hello-world/lupine.json +23 -23
- package/templates/lupine-template-hello-world/web/package.json +6 -6
- package/templates/lupine-template-hello-world/web/src/index.html +16 -16
- package/templates/lupine-template-hello-world/web/src/index.tsx +73 -73
- package/templates/lupine-template-responsive-starter/api/resources/install.sqlite.sql +3 -3
- package/templates/lupine-template-responsive-starter/api/src/index.ts +4 -4
- package/templates/lupine-template-responsive-starter/api/src/service/root-api.ts +18 -18
- package/templates/lupine-template-responsive-starter/lupine.json +7 -7
- package/templates/lupine-template-responsive-starter/web/src/app-icons.ts +76 -76
- package/templates/lupine-template-responsive-starter/web/src/components/input-history-component.tsx +93 -93
- package/templates/lupine-template-responsive-starter/web/src/components/mine-about-page.tsx +86 -86
- package/templates/lupine-template-responsive-starter/web/src/components/mine-premium-page.tsx +80 -80
- package/templates/lupine-template-responsive-starter/web/src/components/mine-settings-page.tsx +220 -219
- package/templates/lupine-template-responsive-starter/web/src/components/mobile-top-search-menu.tsx +119 -119
- package/templates/lupine-template-responsive-starter/web/src/components/note-detail.tsx +116 -116
- package/templates/lupine-template-responsive-starter/web/src/components/note-edit.tsx +154 -154
- package/templates/lupine-template-responsive-starter/web/src/components/note-search-page.tsx +193 -193
- package/templates/lupine-template-responsive-starter/web/src/components/search-input.tsx +95 -95
- package/templates/lupine-template-responsive-starter/web/src/components/side-menu-content.tsx +182 -182
- package/templates/lupine-template-responsive-starter/web/src/frames/app-responsive-frame.tsx +52 -52
- package/templates/lupine-template-responsive-starter/web/src/index.html +16 -16
- package/templates/lupine-template-responsive-starter/web/src/index.tsx +39 -39
- package/templates/lupine-template-responsive-starter/web/src/lupine-template-responsive-starter/404.html +35 -35
- package/templates/lupine-template-responsive-starter/web/src/lupine-template-responsive-starter/index.html +49 -49
- package/templates/lupine-template-responsive-starter/web/src/lupine-template-responsive-starter/index.tsx +32 -32
- package/templates/lupine-template-responsive-starter/web/src/pages/about-page.tsx +43 -43
- package/templates/lupine-template-responsive-starter/web/src/pages/finance-page.tsx +46 -46
- package/templates/lupine-template-responsive-starter/web/src/pages/home-page.tsx +452 -452
- package/templates/lupine-template-responsive-starter/web/src/pages/mine-page.tsx +325 -325
- package/templates/lupine-template-responsive-starter/web/src/pages/tools-page.tsx +46 -46
- package/templates/lupine-template-responsive-starter/web/src/services/local-notes-service.ts +87 -87
- package/templates/lupine-template-responsive-starter/web/src/services/mine-service.ts +45 -45
- package/templates/common/dev/dev-watch.js +0 -389
package/templates/lupine-template-responsive-starter/web/src/components/mobile-top-search-menu.tsx
CHANGED
|
@@ -1,119 +1,119 @@
|
|
|
1
|
-
import { CssProps, RefProps } from 'lupine.components';
|
|
2
|
-
import { MobileTopSysIcon } from 'lupine.components';
|
|
3
|
-
|
|
4
|
-
// Helper hook pattern to pass search calls back to the Homepage
|
|
5
|
-
export const NoteSearchHelper: {
|
|
6
|
-
triggerSearch?: (query: string) => void;
|
|
7
|
-
} = {};
|
|
8
|
-
|
|
9
|
-
export const MobileTopSearchMenu = () => {
|
|
10
|
-
const css: CssProps = {
|
|
11
|
-
display: 'flex',
|
|
12
|
-
flexDirection: 'row',
|
|
13
|
-
width: '100%',
|
|
14
|
-
alignItems: 'center',
|
|
15
|
-
|
|
16
|
-
'.mobile-top-menu-left': {
|
|
17
|
-
display: 'flex',
|
|
18
|
-
flexDirection: 'row',
|
|
19
|
-
flex: 1,
|
|
20
|
-
alignItems: 'center',
|
|
21
|
-
fontSize: '18px',
|
|
22
|
-
fontWeight: 'bold',
|
|
23
|
-
color: 'var(--primary-color)',
|
|
24
|
-
},
|
|
25
|
-
'.mobile-top-menu-right': {
|
|
26
|
-
display: 'flex',
|
|
27
|
-
flexDirection: 'row',
|
|
28
|
-
alignItems: 'center',
|
|
29
|
-
gap: '12px',
|
|
30
|
-
},
|
|
31
|
-
'.mtm-input-group': {
|
|
32
|
-
display: 'none',
|
|
33
|
-
flex: 1,
|
|
34
|
-
marginRight: '12px',
|
|
35
|
-
},
|
|
36
|
-
'.mtm-input-box': {
|
|
37
|
-
width: '100%',
|
|
38
|
-
padding: '4px 8px',
|
|
39
|
-
borderRadius: '4px',
|
|
40
|
-
border: '1px solid var(--secondary-border-color)',
|
|
41
|
-
backgroundColor: 'var(--primary-bg-color)',
|
|
42
|
-
color: 'var(--primary-color)',
|
|
43
|
-
},
|
|
44
|
-
'.mtm-search-icon, .mtm-menu-icon, .mtm-search-cancel': {
|
|
45
|
-
cursor: 'pointer',
|
|
46
|
-
display: 'flex',
|
|
47
|
-
},
|
|
48
|
-
'.mtm-search-cancel': {
|
|
49
|
-
display: 'none',
|
|
50
|
-
fontSize: '14px',
|
|
51
|
-
color: 'var(--primary-color)',
|
|
52
|
-
},
|
|
53
|
-
|
|
54
|
-
// Toggle state specific styles
|
|
55
|
-
'&.show-search': {
|
|
56
|
-
'.mobile-title': { display: 'none' },
|
|
57
|
-
'.mtm-search-icon': { display: 'none' },
|
|
58
|
-
'.mtm-input-group': { display: 'flex' },
|
|
59
|
-
'.mtm-search-cancel': { display: 'flex' },
|
|
60
|
-
},
|
|
61
|
-
};
|
|
62
|
-
|
|
63
|
-
const ref: RefProps = {
|
|
64
|
-
onLoad: async () => {
|
|
65
|
-
ref.$('.mtm-input-box')?.addEventListener('keyup', (e: Event) => {
|
|
66
|
-
if ((e as KeyboardEvent).key === 'Enter') {
|
|
67
|
-
onStartSearch();
|
|
68
|
-
}
|
|
69
|
-
});
|
|
70
|
-
},
|
|
71
|
-
};
|
|
72
|
-
|
|
73
|
-
const toggleSearchMode = () => {
|
|
74
|
-
const root = ref.current;
|
|
75
|
-
if (root) {
|
|
76
|
-
const isSearchMode = root.classList.toggle('show-search');
|
|
77
|
-
if (isSearchMode) {
|
|
78
|
-
(ref.$('.mtm-input-box') as HTMLElement)?.focus();
|
|
79
|
-
} else {
|
|
80
|
-
// Clear search when canceling
|
|
81
|
-
(ref.$('.mtm-input-box') as HTMLInputElement).value = '';
|
|
82
|
-
NoteSearchHelper.triggerSearch?.('');
|
|
83
|
-
}
|
|
84
|
-
}
|
|
85
|
-
};
|
|
86
|
-
|
|
87
|
-
const onStartSearch = () => {
|
|
88
|
-
const val = (ref.$('.mtm-input-box') as HTMLInputElement).value;
|
|
89
|
-
NoteSearchHelper.triggerSearch?.(val);
|
|
90
|
-
};
|
|
91
|
-
|
|
92
|
-
return (
|
|
93
|
-
<div ref={ref} css={css} class='mobile-top-menu-box'>
|
|
94
|
-
<div class='mobile-top-menu-left'>
|
|
95
|
-
<div class='mobile-title'>Notes</div>
|
|
96
|
-
<div class='mtm-input-group'>
|
|
97
|
-
<input
|
|
98
|
-
type='text'
|
|
99
|
-
spellcheck={false}
|
|
100
|
-
class='mtm-input-box'
|
|
101
|
-
placeholder='Search notes...'
|
|
102
|
-
autocomplete='off'
|
|
103
|
-
/>
|
|
104
|
-
</div>
|
|
105
|
-
</div>
|
|
106
|
-
<div class='mobile-top-menu-right'>
|
|
107
|
-
<div class='mtm-search-cancel' onClick={toggleSearchMode}>
|
|
108
|
-
Cancel
|
|
109
|
-
</div>
|
|
110
|
-
<div class='mtm-search-icon' onClick={toggleSearchMode}>
|
|
111
|
-
<i class='ifc-icon bs-search'></i>
|
|
112
|
-
</div>
|
|
113
|
-
<div class='mtm-menu-icon'>
|
|
114
|
-
<MobileTopSysIcon />
|
|
115
|
-
</div>
|
|
116
|
-
</div>
|
|
117
|
-
</div>
|
|
118
|
-
);
|
|
119
|
-
};
|
|
1
|
+
import { CssProps, RefProps } from 'lupine.components';
|
|
2
|
+
import { MobileTopSysIcon } from 'lupine.components';
|
|
3
|
+
|
|
4
|
+
// Helper hook pattern to pass search calls back to the Homepage
|
|
5
|
+
export const NoteSearchHelper: {
|
|
6
|
+
triggerSearch?: (query: string) => void;
|
|
7
|
+
} = {};
|
|
8
|
+
|
|
9
|
+
export const MobileTopSearchMenu = () => {
|
|
10
|
+
const css: CssProps = {
|
|
11
|
+
display: 'flex',
|
|
12
|
+
flexDirection: 'row',
|
|
13
|
+
width: '100%',
|
|
14
|
+
alignItems: 'center',
|
|
15
|
+
|
|
16
|
+
'.mobile-top-menu-left': {
|
|
17
|
+
display: 'flex',
|
|
18
|
+
flexDirection: 'row',
|
|
19
|
+
flex: 1,
|
|
20
|
+
alignItems: 'center',
|
|
21
|
+
fontSize: '18px',
|
|
22
|
+
fontWeight: 'bold',
|
|
23
|
+
color: 'var(--primary-color)',
|
|
24
|
+
},
|
|
25
|
+
'.mobile-top-menu-right': {
|
|
26
|
+
display: 'flex',
|
|
27
|
+
flexDirection: 'row',
|
|
28
|
+
alignItems: 'center',
|
|
29
|
+
gap: '12px',
|
|
30
|
+
},
|
|
31
|
+
'.mtm-input-group': {
|
|
32
|
+
display: 'none',
|
|
33
|
+
flex: 1,
|
|
34
|
+
marginRight: '12px',
|
|
35
|
+
},
|
|
36
|
+
'.mtm-input-box': {
|
|
37
|
+
width: '100%',
|
|
38
|
+
padding: '4px 8px',
|
|
39
|
+
borderRadius: '4px',
|
|
40
|
+
border: '1px solid var(--secondary-border-color)',
|
|
41
|
+
backgroundColor: 'var(--primary-bg-color)',
|
|
42
|
+
color: 'var(--primary-color)',
|
|
43
|
+
},
|
|
44
|
+
'.mtm-search-icon, .mtm-menu-icon, .mtm-search-cancel': {
|
|
45
|
+
cursor: 'pointer',
|
|
46
|
+
display: 'flex',
|
|
47
|
+
},
|
|
48
|
+
'.mtm-search-cancel': {
|
|
49
|
+
display: 'none',
|
|
50
|
+
fontSize: '14px',
|
|
51
|
+
color: 'var(--primary-color)',
|
|
52
|
+
},
|
|
53
|
+
|
|
54
|
+
// Toggle state specific styles
|
|
55
|
+
'&.show-search': {
|
|
56
|
+
'.mobile-title': { display: 'none' },
|
|
57
|
+
'.mtm-search-icon': { display: 'none' },
|
|
58
|
+
'.mtm-input-group': { display: 'flex' },
|
|
59
|
+
'.mtm-search-cancel': { display: 'flex' },
|
|
60
|
+
},
|
|
61
|
+
};
|
|
62
|
+
|
|
63
|
+
const ref: RefProps = {
|
|
64
|
+
onLoad: async () => {
|
|
65
|
+
ref.$('.mtm-input-box')?.addEventListener('keyup', (e: Event) => {
|
|
66
|
+
if ((e as KeyboardEvent).key === 'Enter') {
|
|
67
|
+
onStartSearch();
|
|
68
|
+
}
|
|
69
|
+
});
|
|
70
|
+
},
|
|
71
|
+
};
|
|
72
|
+
|
|
73
|
+
const toggleSearchMode = () => {
|
|
74
|
+
const root = ref.current;
|
|
75
|
+
if (root) {
|
|
76
|
+
const isSearchMode = root.classList.toggle('show-search');
|
|
77
|
+
if (isSearchMode) {
|
|
78
|
+
(ref.$('.mtm-input-box') as HTMLElement)?.focus();
|
|
79
|
+
} else {
|
|
80
|
+
// Clear search when canceling
|
|
81
|
+
(ref.$('.mtm-input-box') as HTMLInputElement).value = '';
|
|
82
|
+
NoteSearchHelper.triggerSearch?.('');
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
};
|
|
86
|
+
|
|
87
|
+
const onStartSearch = () => {
|
|
88
|
+
const val = (ref.$('.mtm-input-box') as HTMLInputElement).value;
|
|
89
|
+
NoteSearchHelper.triggerSearch?.(val);
|
|
90
|
+
};
|
|
91
|
+
|
|
92
|
+
return (
|
|
93
|
+
<div ref={ref} css={css} class='mobile-top-menu-box'>
|
|
94
|
+
<div class='mobile-top-menu-left'>
|
|
95
|
+
<div class='mobile-title'>Notes</div>
|
|
96
|
+
<div class='mtm-input-group'>
|
|
97
|
+
<input
|
|
98
|
+
type='text'
|
|
99
|
+
spellcheck={false}
|
|
100
|
+
class='mtm-input-box'
|
|
101
|
+
placeholder='Search notes...'
|
|
102
|
+
autocomplete='off'
|
|
103
|
+
/>
|
|
104
|
+
</div>
|
|
105
|
+
</div>
|
|
106
|
+
<div class='mobile-top-menu-right'>
|
|
107
|
+
<div class='mtm-search-cancel' onClick={toggleSearchMode}>
|
|
108
|
+
Cancel
|
|
109
|
+
</div>
|
|
110
|
+
<div class='mtm-search-icon' onClick={toggleSearchMode}>
|
|
111
|
+
<i class='ifc-icon bs-search'></i>
|
|
112
|
+
</div>
|
|
113
|
+
<div class='mtm-menu-icon'>
|
|
114
|
+
<MobileTopSysIcon />
|
|
115
|
+
</div>
|
|
116
|
+
</div>
|
|
117
|
+
</div>
|
|
118
|
+
);
|
|
119
|
+
};
|
|
@@ -1,116 +1,116 @@
|
|
|
1
|
-
import {
|
|
2
|
-
CssProps,
|
|
3
|
-
PageProps,
|
|
4
|
-
RefProps,
|
|
5
|
-
SliderFrameHookProps,
|
|
6
|
-
HeaderWithBackFrame,
|
|
7
|
-
ActionSheetSelect,
|
|
8
|
-
} from 'lupine.components';
|
|
9
|
-
import { LocalNoteProps, LocalNotesService } from '../services/local-notes-service';
|
|
10
|
-
import { NoteEditComponent } from './note-edit';
|
|
11
|
-
|
|
12
|
-
interface NoteDetailProps {
|
|
13
|
-
note: LocalNoteProps;
|
|
14
|
-
sliderFrameHook: SliderFrameHookProps;
|
|
15
|
-
onSaved: () => void;
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
export const NoteDetailComponent = async (props: NoteDetailProps) => {
|
|
19
|
-
const css: CssProps = {
|
|
20
|
-
flex: 1,
|
|
21
|
-
overflowY: 'auto',
|
|
22
|
-
padding: '24px',
|
|
23
|
-
backgroundColor: 'var(--primary-bg-color)',
|
|
24
|
-
|
|
25
|
-
'.note-detail-title': {
|
|
26
|
-
fontSize: '24px',
|
|
27
|
-
fontWeight: 'bold',
|
|
28
|
-
color: 'var(--primary-color)',
|
|
29
|
-
marginBottom: '12px',
|
|
30
|
-
lineHeight: '1.4',
|
|
31
|
-
},
|
|
32
|
-
'.note-detail-date': {
|
|
33
|
-
fontSize: '13px',
|
|
34
|
-
color: 'var(--secondary-color)',
|
|
35
|
-
},
|
|
36
|
-
'.note-detail-meta': {
|
|
37
|
-
display: 'flex',
|
|
38
|
-
gap: '12px',
|
|
39
|
-
alignItems: 'center',
|
|
40
|
-
marginBottom: '24px',
|
|
41
|
-
paddingBottom: '16px',
|
|
42
|
-
borderBottom: '1px solid var(--primary-border-color)',
|
|
43
|
-
},
|
|
44
|
-
'.note-detail-content': {
|
|
45
|
-
fontSize: '16px',
|
|
46
|
-
color: 'var(--primary-color)',
|
|
47
|
-
lineHeight: '1.6',
|
|
48
|
-
whiteSpace: 'pre-wrap',
|
|
49
|
-
wordBreak: 'break-word',
|
|
50
|
-
},
|
|
51
|
-
'.header-action-icon': {
|
|
52
|
-
fontSize: '20px',
|
|
53
|
-
padding: '4px',
|
|
54
|
-
cursor: 'pointer',
|
|
55
|
-
color: 'var(--primary-color)',
|
|
56
|
-
},
|
|
57
|
-
'.header-actions-container': {
|
|
58
|
-
display: 'flex',
|
|
59
|
-
gap: '16px',
|
|
60
|
-
alignItems: 'center',
|
|
61
|
-
},
|
|
62
|
-
'.header-action-delete': {
|
|
63
|
-
color: '#ff4d4f',
|
|
64
|
-
},
|
|
65
|
-
'.note-detail-color-marker': {
|
|
66
|
-
width: '16px',
|
|
67
|
-
height: '16px',
|
|
68
|
-
borderRadius: '4px',
|
|
69
|
-
},
|
|
70
|
-
};
|
|
71
|
-
|
|
72
|
-
const onEdit = () => {
|
|
73
|
-
// Open edit component and pass the current note
|
|
74
|
-
props.sliderFrameHook.load!(
|
|
75
|
-
<NoteEditComponent note={props.note} sliderFrameHook={props.sliderFrameHook} onSaved={props.onSaved} />
|
|
76
|
-
);
|
|
77
|
-
};
|
|
78
|
-
|
|
79
|
-
const onDelete = async () => {
|
|
80
|
-
await ActionSheetSelect.show({
|
|
81
|
-
title: 'Are you sure you want to delete this note?',
|
|
82
|
-
options: ['Remove'],
|
|
83
|
-
cancelButtonText: 'Cancel',
|
|
84
|
-
handleClicked: async (index: number, close: () => void) => {
|
|
85
|
-
close();
|
|
86
|
-
if (index === 0) {
|
|
87
|
-
LocalNotesService.deleteNote(props.note.id);
|
|
88
|
-
props.onSaved(); // trigger list refresh
|
|
89
|
-
props.sliderFrameHook.close!(new MouseEvent('click')); // close detail view
|
|
90
|
-
}
|
|
91
|
-
},
|
|
92
|
-
});
|
|
93
|
-
};
|
|
94
|
-
|
|
95
|
-
const pageRight = (
|
|
96
|
-
<div class='header-actions-container'>
|
|
97
|
-
<i class='ifc-icon ma-pencil-outline header-action-icon' onClick={onEdit}></i>
|
|
98
|
-
<i class='ifc-icon ma-delete-off-outline header-action-icon header-action-delete' onClick={onDelete}></i>
|
|
99
|
-
</div>
|
|
100
|
-
);
|
|
101
|
-
|
|
102
|
-
return (
|
|
103
|
-
<HeaderWithBackFrame title='Details' onBack={(e: Event) => props.sliderFrameHook.close!(e)} right={pageRight}>
|
|
104
|
-
<div css={css} class='note-detail-wrapper no-scrollbar-container flex-col h-100'>
|
|
105
|
-
<div class='note-detail-title'>{props.note.title}</div>
|
|
106
|
-
<div class='note-detail-meta'>
|
|
107
|
-
{props.note.color && (
|
|
108
|
-
<div class='note-detail-color-marker' style={{ backgroundColor: props.note.color }}></div>
|
|
109
|
-
)}
|
|
110
|
-
<div class='note-detail-date'>{new Date(props.note.updatedAt).toLocaleString()}</div>
|
|
111
|
-
</div>
|
|
112
|
-
<div class='note-detail-content'>{props.note.content}</div>
|
|
113
|
-
</div>
|
|
114
|
-
</HeaderWithBackFrame>
|
|
115
|
-
);
|
|
116
|
-
};
|
|
1
|
+
import {
|
|
2
|
+
CssProps,
|
|
3
|
+
PageProps,
|
|
4
|
+
RefProps,
|
|
5
|
+
SliderFrameHookProps,
|
|
6
|
+
HeaderWithBackFrame,
|
|
7
|
+
ActionSheetSelect,
|
|
8
|
+
} from 'lupine.components';
|
|
9
|
+
import { LocalNoteProps, LocalNotesService } from '../services/local-notes-service';
|
|
10
|
+
import { NoteEditComponent } from './note-edit';
|
|
11
|
+
|
|
12
|
+
interface NoteDetailProps {
|
|
13
|
+
note: LocalNoteProps;
|
|
14
|
+
sliderFrameHook: SliderFrameHookProps;
|
|
15
|
+
onSaved: () => void;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export const NoteDetailComponent = async (props: NoteDetailProps) => {
|
|
19
|
+
const css: CssProps = {
|
|
20
|
+
flex: 1,
|
|
21
|
+
overflowY: 'auto',
|
|
22
|
+
padding: '24px',
|
|
23
|
+
backgroundColor: 'var(--primary-bg-color)',
|
|
24
|
+
|
|
25
|
+
'.note-detail-title': {
|
|
26
|
+
fontSize: '24px',
|
|
27
|
+
fontWeight: 'bold',
|
|
28
|
+
color: 'var(--primary-color)',
|
|
29
|
+
marginBottom: '12px',
|
|
30
|
+
lineHeight: '1.4',
|
|
31
|
+
},
|
|
32
|
+
'.note-detail-date': {
|
|
33
|
+
fontSize: '13px',
|
|
34
|
+
color: 'var(--secondary-color)',
|
|
35
|
+
},
|
|
36
|
+
'.note-detail-meta': {
|
|
37
|
+
display: 'flex',
|
|
38
|
+
gap: '12px',
|
|
39
|
+
alignItems: 'center',
|
|
40
|
+
marginBottom: '24px',
|
|
41
|
+
paddingBottom: '16px',
|
|
42
|
+
borderBottom: '1px solid var(--primary-border-color)',
|
|
43
|
+
},
|
|
44
|
+
'.note-detail-content': {
|
|
45
|
+
fontSize: '16px',
|
|
46
|
+
color: 'var(--primary-color)',
|
|
47
|
+
lineHeight: '1.6',
|
|
48
|
+
whiteSpace: 'pre-wrap',
|
|
49
|
+
wordBreak: 'break-word',
|
|
50
|
+
},
|
|
51
|
+
'.header-action-icon': {
|
|
52
|
+
fontSize: '20px',
|
|
53
|
+
padding: '4px',
|
|
54
|
+
cursor: 'pointer',
|
|
55
|
+
color: 'var(--primary-color)',
|
|
56
|
+
},
|
|
57
|
+
'.header-actions-container': {
|
|
58
|
+
display: 'flex',
|
|
59
|
+
gap: '16px',
|
|
60
|
+
alignItems: 'center',
|
|
61
|
+
},
|
|
62
|
+
'.header-action-delete': {
|
|
63
|
+
color: '#ff4d4f',
|
|
64
|
+
},
|
|
65
|
+
'.note-detail-color-marker': {
|
|
66
|
+
width: '16px',
|
|
67
|
+
height: '16px',
|
|
68
|
+
borderRadius: '4px',
|
|
69
|
+
},
|
|
70
|
+
};
|
|
71
|
+
|
|
72
|
+
const onEdit = () => {
|
|
73
|
+
// Open edit component and pass the current note
|
|
74
|
+
props.sliderFrameHook.load!(
|
|
75
|
+
<NoteEditComponent note={props.note} sliderFrameHook={props.sliderFrameHook} onSaved={props.onSaved} />
|
|
76
|
+
);
|
|
77
|
+
};
|
|
78
|
+
|
|
79
|
+
const onDelete = async () => {
|
|
80
|
+
await ActionSheetSelect.show({
|
|
81
|
+
title: 'Are you sure you want to delete this note?',
|
|
82
|
+
options: ['Remove'],
|
|
83
|
+
cancelButtonText: 'Cancel',
|
|
84
|
+
handleClicked: async (index: number, close: () => void) => {
|
|
85
|
+
close();
|
|
86
|
+
if (index === 0) {
|
|
87
|
+
LocalNotesService.deleteNote(props.note.id);
|
|
88
|
+
props.onSaved(); // trigger list refresh
|
|
89
|
+
props.sliderFrameHook.close!(new MouseEvent('click')); // close detail view
|
|
90
|
+
}
|
|
91
|
+
},
|
|
92
|
+
});
|
|
93
|
+
};
|
|
94
|
+
|
|
95
|
+
const pageRight = (
|
|
96
|
+
<div class='header-actions-container'>
|
|
97
|
+
<i class='ifc-icon ma-pencil-outline header-action-icon' onClick={onEdit}></i>
|
|
98
|
+
<i class='ifc-icon ma-delete-off-outline header-action-icon header-action-delete' onClick={onDelete}></i>
|
|
99
|
+
</div>
|
|
100
|
+
);
|
|
101
|
+
|
|
102
|
+
return (
|
|
103
|
+
<HeaderWithBackFrame title='Details' onBack={(e: Event) => props.sliderFrameHook.close!(e)} right={pageRight}>
|
|
104
|
+
<div css={css} class='note-detail-wrapper no-scrollbar-container flex-col h-100'>
|
|
105
|
+
<div class='note-detail-title'>{props.note.title}</div>
|
|
106
|
+
<div class='note-detail-meta'>
|
|
107
|
+
{props.note.color && (
|
|
108
|
+
<div class='note-detail-color-marker' style={{ backgroundColor: props.note.color }}></div>
|
|
109
|
+
)}
|
|
110
|
+
<div class='note-detail-date'>{new Date(props.note.updatedAt).toLocaleString()}</div>
|
|
111
|
+
</div>
|
|
112
|
+
<div class='note-detail-content'>{props.note.content}</div>
|
|
113
|
+
</div>
|
|
114
|
+
</HeaderWithBackFrame>
|
|
115
|
+
);
|
|
116
|
+
};
|