@jant/core 0.3.25 → 0.3.26

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 (131) hide show
  1. package/dist/app.js +67 -562
  2. package/dist/client.js +1 -0
  3. package/dist/i18n/locales/en.js +1 -1
  4. package/dist/i18n/locales/zh-Hans.js +1 -1
  5. package/dist/i18n/locales/zh-Hant.js +1 -1
  6. package/dist/lib/avatar-upload.js +134 -0
  7. package/dist/lib/config.js +39 -0
  8. package/dist/lib/constants.js +10 -10
  9. package/dist/lib/favicon.js +102 -0
  10. package/dist/lib/image.js +13 -17
  11. package/dist/lib/media-helpers.js +2 -2
  12. package/dist/lib/navigation.js +23 -3
  13. package/dist/lib/render.js +10 -1
  14. package/dist/lib/schemas.js +31 -0
  15. package/dist/lib/timezones.js +388 -0
  16. package/dist/lib/view.js +1 -1
  17. package/dist/routes/api/posts.js +1 -1
  18. package/dist/routes/api/upload.js +3 -3
  19. package/dist/routes/auth/reset.js +221 -0
  20. package/dist/routes/auth/setup.js +194 -0
  21. package/dist/routes/auth/signin.js +176 -0
  22. package/dist/routes/dash/collections.js +23 -415
  23. package/dist/routes/dash/media.js +12 -392
  24. package/dist/routes/dash/pages.js +7 -330
  25. package/dist/routes/dash/redirects.js +18 -12
  26. package/dist/routes/dash/settings.js +198 -577
  27. package/dist/routes/feed/rss.js +2 -1
  28. package/dist/routes/feed/sitemap.js +4 -2
  29. package/dist/routes/pages/featured.js +5 -1
  30. package/dist/routes/pages/home.js +26 -1
  31. package/dist/routes/pages/latest.js +45 -0
  32. package/dist/services/post.js +30 -50
  33. package/dist/types/bindings.js +3 -0
  34. package/dist/types/config.js +147 -0
  35. package/dist/types/constants.js +27 -0
  36. package/dist/types/entities.js +3 -0
  37. package/dist/types/operations.js +3 -0
  38. package/dist/types/props.js +3 -0
  39. package/dist/types/views.js +5 -0
  40. package/dist/types.js +8 -111
  41. package/dist/ui/color-themes.js +33 -33
  42. package/dist/ui/compose/ComposeDialog.js +36 -21
  43. package/dist/ui/dash/PageForm.js +21 -15
  44. package/dist/ui/dash/PostForm.js +22 -16
  45. package/dist/ui/dash/collections/CollectionForm.js +152 -0
  46. package/dist/ui/dash/collections/CollectionsListContent.js +68 -0
  47. package/dist/ui/dash/collections/ViewCollectionContent.js +96 -0
  48. package/dist/ui/dash/media/MediaListContent.js +166 -0
  49. package/dist/ui/dash/media/ViewMediaContent.js +212 -0
  50. package/dist/ui/dash/pages/LinkFormContent.js +130 -0
  51. package/dist/ui/dash/pages/UnifiedPagesContent.js +193 -0
  52. package/dist/ui/dash/settings/AccountContent.js +209 -0
  53. package/dist/ui/dash/settings/AppearanceContent.js +259 -0
  54. package/dist/ui/dash/settings/GeneralContent.js +536 -0
  55. package/dist/ui/dash/settings/SettingsNav.js +41 -0
  56. package/dist/ui/font-themes.js +36 -0
  57. package/dist/ui/layouts/BaseLayout.js +24 -2
  58. package/dist/ui/layouts/SiteLayout.js +47 -19
  59. package/package.json +1 -1
  60. package/src/app.tsx +93 -553
  61. package/src/client.ts +1 -0
  62. package/src/i18n/locales/en.po +240 -175
  63. package/src/i18n/locales/en.ts +1 -1
  64. package/src/i18n/locales/zh-Hans.po +240 -175
  65. package/src/i18n/locales/zh-Hans.ts +1 -1
  66. package/src/i18n/locales/zh-Hant.po +240 -175
  67. package/src/i18n/locales/zh-Hant.ts +1 -1
  68. package/src/lib/__tests__/config.test.ts +192 -0
  69. package/src/lib/__tests__/favicon.test.ts +151 -0
  70. package/src/lib/__tests__/image.test.ts +2 -6
  71. package/src/lib/__tests__/timezones.test.ts +61 -0
  72. package/src/lib/__tests__/view.test.ts +2 -2
  73. package/src/lib/avatar-upload.ts +165 -0
  74. package/src/lib/config.ts +47 -0
  75. package/src/lib/constants.ts +19 -11
  76. package/src/lib/favicon.ts +115 -0
  77. package/src/lib/image.ts +13 -21
  78. package/src/lib/media-helpers.ts +2 -2
  79. package/src/lib/navigation.ts +33 -2
  80. package/src/lib/render.tsx +15 -1
  81. package/src/lib/schemas.ts +39 -0
  82. package/src/lib/timezones.ts +325 -0
  83. package/src/lib/view.ts +1 -1
  84. package/src/routes/api/posts.ts +1 -1
  85. package/src/routes/api/upload.ts +2 -3
  86. package/src/routes/auth/reset.tsx +239 -0
  87. package/src/routes/auth/setup.tsx +189 -0
  88. package/src/routes/auth/signin.tsx +163 -0
  89. package/src/routes/dash/__tests__/settings-avatar.test.ts +89 -0
  90. package/src/routes/dash/collections.tsx +17 -366
  91. package/src/routes/dash/media.tsx +12 -414
  92. package/src/routes/dash/pages.tsx +8 -348
  93. package/src/routes/dash/redirects.tsx +20 -14
  94. package/src/routes/dash/settings.tsx +243 -534
  95. package/src/routes/feed/__tests__/rss.test.ts +141 -0
  96. package/src/routes/feed/rss.ts +3 -1
  97. package/src/routes/feed/sitemap.ts +4 -2
  98. package/src/routes/pages/featured.tsx +7 -1
  99. package/src/routes/pages/home.tsx +25 -2
  100. package/src/routes/pages/latest.tsx +59 -0
  101. package/src/services/post.ts +34 -66
  102. package/src/styles/components.css +0 -65
  103. package/src/styles/tokens.css +1 -1
  104. package/src/styles/ui.css +24 -40
  105. package/src/types/bindings.ts +30 -0
  106. package/src/types/config.ts +183 -0
  107. package/src/types/constants.ts +26 -0
  108. package/src/types/entities.ts +109 -0
  109. package/src/types/operations.ts +88 -0
  110. package/src/types/props.ts +115 -0
  111. package/src/types/views.ts +172 -0
  112. package/src/types.ts +8 -644
  113. package/src/ui/__tests__/font-themes.test.ts +34 -0
  114. package/src/ui/color-themes.ts +34 -34
  115. package/src/ui/compose/ComposeDialog.tsx +40 -21
  116. package/src/ui/dash/PageForm.tsx +25 -19
  117. package/src/ui/dash/PostForm.tsx +26 -20
  118. package/src/ui/dash/collections/CollectionForm.tsx +153 -0
  119. package/src/ui/dash/collections/CollectionsListContent.tsx +85 -0
  120. package/src/ui/dash/collections/ViewCollectionContent.tsx +92 -0
  121. package/src/ui/dash/media/MediaListContent.tsx +201 -0
  122. package/src/ui/dash/media/ViewMediaContent.tsx +208 -0
  123. package/src/ui/dash/pages/LinkFormContent.tsx +119 -0
  124. package/src/ui/dash/pages/UnifiedPagesContent.tsx +203 -0
  125. package/src/ui/dash/settings/AccountContent.tsx +176 -0
  126. package/src/ui/dash/settings/AppearanceContent.tsx +254 -0
  127. package/src/ui/dash/settings/GeneralContent.tsx +533 -0
  128. package/src/ui/dash/settings/SettingsNav.tsx +56 -0
  129. package/src/ui/font-themes.ts +54 -0
  130. package/src/ui/layouts/BaseLayout.tsx +17 -0
  131. package/src/ui/layouts/SiteLayout.tsx +45 -31
@@ -32,47 +32,47 @@ export const SiteLayout: FC<PropsWithChildren<SiteLayoutProps>> = ({
32
32
  currentPath,
33
33
  isAuthenticated,
34
34
  collections,
35
+ homeDefaultView,
36
+ siteAvatarUrl,
37
+ showHeaderAvatar,
38
+ siteFooterHtml,
35
39
  children,
36
40
  }) => {
37
41
  const { t } = useLingui();
38
42
 
39
- const browseLinks = [
40
- {
41
- href: "/",
42
- label: t({
43
- message: "Latest",
44
- comment: "@context: Browse filter for latest posts",
45
- }),
46
- },
47
- {
48
- href: "/featured",
49
- label: t({
50
- message: "Featured",
51
- comment: "@context: Browse filter for featured posts",
52
- }),
53
- },
54
- // {
55
- // href: "/collections",
56
- // label: t({
57
- // message: "Collections",
58
- // comment: "@context: Browse filter for collections",
59
- // }),
60
- // },
61
- // {
62
- // href: "/archive",
63
- // label: t({
64
- // message: "Archive",
65
- // comment: "@context: Browse filter for archive",
66
- // }),
67
- // },
68
- ];
43
+ const latestHref = homeDefaultView === "featured" ? "/latest" : "/";
44
+ const featuredHref = homeDefaultView === "featured" ? "/" : "/featured";
45
+
46
+ const latestLink = {
47
+ href: latestHref,
48
+ label: t({
49
+ message: "Latest",
50
+ comment: "@context: Browse filter for latest posts",
51
+ }),
52
+ };
53
+ const featuredLink = {
54
+ href: featuredHref,
55
+ label: t({
56
+ message: "Featured",
57
+ comment: "@context: Browse filter for featured posts",
58
+ }),
59
+ };
60
+
61
+ // Default view tab comes first
62
+ const browseLinks =
63
+ homeDefaultView === "featured"
64
+ ? [featuredLink, latestLink]
65
+ : [latestLink, featuredLink];
69
66
 
70
67
  const searchLabel = t({
71
68
  message: "Search",
72
69
  comment: "@context: Search icon link in browse nav",
73
70
  });
74
71
 
75
- const isHomePage = currentPath === "/" || currentPath === "/featured";
72
+ const isHomePage =
73
+ currentPath === "/" ||
74
+ currentPath === "/featured" ||
75
+ currentPath === "/latest";
76
76
 
77
77
  return (
78
78
  <div class="site-page">
@@ -80,6 +80,9 @@ export const SiteLayout: FC<PropsWithChildren<SiteLayoutProps>> = ({
80
80
  <div class="site-header-inner">
81
81
  <div class="site-header-top site-header-top-bordered">
82
82
  <a href="/" class="site-logo">
83
+ {showHeaderAvatar && siteAvatarUrl && (
84
+ <img src={siteAvatarUrl} class="site-logo-avatar" alt="" />
85
+ )}
83
86
  {siteName}
84
87
  </a>
85
88
  <div class="site-header-right">
@@ -144,6 +147,17 @@ export const SiteLayout: FC<PropsWithChildren<SiteLayoutProps>> = ({
144
147
  </div>
145
148
  </main>
146
149
 
150
+ {siteFooterHtml && (
151
+ <footer class="site-footer" data-footer>
152
+ <div class="site-container">
153
+ <div
154
+ class="prose"
155
+ dangerouslySetInnerHTML={{ __html: siteFooterHtml }}
156
+ />
157
+ </div>
158
+ </footer>
159
+ )}
160
+
147
161
  {isAuthenticated && <ComposeDialog collections={collections} />}
148
162
  </div>
149
163
  );