dsh-half-page 0.3.23 → 0.3.24

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 (2) hide show
  1. package/client.js +10 -3
  2. package/package.json +1 -1
package/client.js CHANGED
@@ -202,7 +202,7 @@ window.__ModuleLoader__.load({
202
202
 
203
203
  const tabs = h('div', { style: S.row },
204
204
  ['read', 'works', 'fav', 'set'].map((k) => h('div', {
205
- key: k, style: S.tab(tab === k), onClick: () => { setTab(k); if (k === 'works' && !works) loadWorks() },
205
+ key: k, style: S.tab(tab === k), onClick: () => { setTab(k); if ((k === 'works' || k === 'fav') && !works) loadWorks() },
206
206
  }, k === 'read' ? '读书' : k === 'works' ? '她的作品' : k === 'fav' ? '收藏' : '设置')),
207
207
  h('div', { style: { flex: 1 } }),
208
208
  msg ? h('div', { style: { ...S.dim, color: C.ok } }, msg) : null,
@@ -456,14 +456,21 @@ window.__ModuleLoader__.load({
456
456
  const favTab = h('div', { style: { display: 'flex', flexDirection: 'column', gap: 10 } },
457
457
  h('div', { style: S.card },
458
458
  h('div', { style: { fontWeight: 600, marginBottom: 6 } }, '收藏'),
459
- favs.length ? favs.map((f, i) => h('div', { key: i, style: S.item },
459
+ favs.length ? favs.map((f, i) => {
460
+ const isFile = String(f).startsWith('file:')
461
+ const fpath = isFile ? f.slice(5) : ''
462
+ const w = isFile && works && (works.files || []).find((x) => x.path === fpath)
463
+ const who = w ? w.author : ''
464
+ return h('div', { key: i, style: S.item },
460
465
  h('div', {
461
466
  style: { flex: 1, cursor: 'pointer', borderTop: i ? '1px solid ' + C.line : 'none', paddingTop: i ? 8 : 0 },
462
467
  onClick: () => openFav(f),
463
468
  }, String(f).startsWith('file:') ? f.slice(5) : f.replace('|', ' · ')),
469
+ isFile ? h('div', { style: who ? S.dim : { ...S.dim, color: C.warn } }, who ? ('署名 · ' + who) : '未署名') : null,
464
470
  h('button', { style: S.btn, onClick: () => copyFav(f) }, '复制'),
465
471
  h('button', { style: S.btn, onClick: () => toggleFav(f) }, '取消收藏'),
466
- )) : h('div', { style: S.dim }, '在读后感或作品上点 ☆,收藏的东西会出现在这儿。'),
472
+ )
473
+ }) : h('div', { style: S.dim }, '在读后感或作品上点 ☆,收藏的东西会出现在这儿。'),
467
474
  ),
468
475
  opened && String(opened.path || '').startsWith('fav:')
469
476
  ? h('div', { style: { ...S.text, marginTop: 0 } }, (opened.title ? opened.title + '\n\n' : '') + opened.text)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-half-page",
3
- "version": "0.3.23",
3
+ "version": "0.3.24",
4
4
  "private": false,
5
5
  "author": "鹿野 <luye@dsh.local>",
6
6
  "license": "MIT",