diff --git a/.forgejo/workflows/depoly.yml b/.forgejo/workflows/depoly.yml index 4195610..a340d9d 100644 --- a/.forgejo/workflows/depoly.yml +++ b/.forgejo/workflows/depoly.yml @@ -28,13 +28,8 @@ jobs: - name: Install Dependencies run: pnpm i - - name: Build Dist (Staging) - run: pnpm dist -m staging - if: env.GITHUB_REF_NAME == 'master' - - name: Build Dist run: pnpm dist - if: env.GITHUB_REF_NAME != 'master' - name: Depoly to Preview uses: https://github.com/cloudflare/wrangler-action@v3 diff --git a/package.json b/package.json index 8b98434..63fe582 100644 --- a/package.json +++ b/package.json @@ -20,7 +20,6 @@ "prettier": "^3.3.2", "typescript": "^5.5.2", "vite": "^5.3.2", - "vite-plugin-package-version": "^1.1.0", "vite-plugin-pwa": "^0.20.0", "vite-plugin-solid": "^2.10.2", "vite-plugin-solid-styled": "^0.11.1", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 9651bfd..acc4341 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -69,9 +69,6 @@ importers: vite: specifier: ^5.3.2 version: 5.3.2(@types/node@20.14.10)(lightningcss@1.25.1)(terser@5.31.2) - vite-plugin-package-version: - specifier: ^1.1.0 - version: 1.1.0(vite@5.3.2(@types/node@20.14.10)(lightningcss@1.25.1)(terser@5.31.2)) vite-plugin-pwa: specifier: ^0.20.0 version: 0.20.0(vite@5.3.2(@types/node@20.14.10)(lightningcss@1.25.1)(terser@5.31.2))(workbox-build@7.1.1(@types/babel__core@7.20.5))(workbox-window@7.1.0) @@ -2492,11 +2489,6 @@ packages: validate-html-nesting@1.2.2: resolution: {integrity: sha512-hGdgQozCsQJMyfK5urgFcWEqsSSrK63Awe0t/IMR0bZ0QMtnuaiHzThW81guu3qx9abLi99NEuiaN6P9gVYsNg==} - vite-plugin-package-version@1.1.0: - resolution: {integrity: sha512-TPoFZXNanzcaKCIrC3e2L/TVRkkRLB6l4RPN/S7KbG7rWfyLcCEGsnXvxn6qR7fyZwXalnnSN/I9d6pSFjHpEA==} - peerDependencies: - vite: '>=2.0.0-beta.69' - vite-plugin-pwa@0.20.0: resolution: {integrity: sha512-/kDZyqF8KqoXRpMUQtR5Atri/7BWayW8Gp7Kz/4bfstsV6zSFTxjREbXZYL7zSuRL40HGA+o2hvUAFRmC+bL7g==} engines: {node: '>=16.0.0'} @@ -5288,10 +5280,6 @@ snapshots: validate-html-nesting@1.2.2: {} - vite-plugin-package-version@1.1.0(vite@5.3.2(@types/node@20.14.10)(lightningcss@1.25.1)(terser@5.31.2)): - dependencies: - vite: 5.3.2(@types/node@20.14.10)(lightningcss@1.25.1)(terser@5.31.2) - vite-plugin-pwa@0.20.0(vite@5.3.2(@types/node@20.14.10)(lightningcss@1.25.1)(terser@5.31.2))(workbox-build@7.1.1(@types/babel__core@7.20.5))(workbox-window@7.1.0): dependencies: debug: 4.3.5 diff --git a/src/App.css b/src/App.css index 26dd292..c04a937 100644 --- a/src/App.css +++ b/src/App.css @@ -1,4 +1,14 @@ -:root { +html, +body { + overflow: hidden; + height: 100vh; + height: 100dvh; +} + +#root { + overflow: hidden hidden; + height: 100vh; + height: 100dvh; background-color: var(--tutu-color-surface, transparent); } diff --git a/src/App.tsx b/src/App.tsx index 8a711e1..4a36e23 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -22,15 +22,11 @@ const AccountMastodonOAuth2Callback = lazy( () => import("./accounts/MastodonOAuth2Callback.js"), ); const TimelineHome = lazy(() => import("./timelines/Home.js")); -const Settings = lazy(() => import("./settings/Settings.js")); const Routing: Component = () => { return ( - - - - + ("accounts", [], { @@ -82,23 +75,6 @@ export const acceptAccountViaAuthCode = action( }, ); -export const updateAcctInf = action( - $accounts, - "updateAcctInf", - async ($store, idx: number) => { - const o = $store.get(); - const client = createMastoClientFor(o[idx]); - const inf = await client.v1.accounts.verifyCredentials(); - o[idx].inf = inf; - $store.set(o); - return inf; - }, -); - -export const signOut = action($accounts, "signOut", ($store, predicate: (acct: Account) => boolean) => { - $store.set($store.get().filter(a => !predicate(a))); -}); - export type RegisteredApp = { site: string; clientId: string; diff --git a/src/masto/acct.ts b/src/masto/acct.ts index b1a2a28..eafd297 100644 --- a/src/masto/acct.ts +++ b/src/masto/acct.ts @@ -1,35 +1,10 @@ import { Accessor, createResource } from "solid-js"; import type { mastodon } from "masto"; -import { useSessions } from "./clients"; -import { updateAcctInf } from "../accounts/stores"; export function useAcctProfile(client: Accessor) { - return createResource( - client, - (client) => { - return client.v1.accounts.verifyCredentials(); - }, - { - name: "MastodonAccountProfile", - }, - ); -} - -export function useSignedInProfiles() { - const sessions = useSessions(); - const [accessor, tools] = createResource(sessions, async (all) => { - return Promise.all( - all.map(async (x, i) => ({ ...x, inf: await updateAcctInf(i) })), - ); - }); - return [ - () => { - if (accessor.loading) { - accessor(); - return sessions().map((x) => ({ ...x, inf: x.account.inf })); - } - return accessor(); - }, - tools, - ] as const; + return createResource(client, (client) => { + return client.v1.accounts.verifyCredentials() + }, { + name: "MastodonAccountProfile" + }) } diff --git a/src/masto/clients.ts b/src/masto/clients.ts index f100779..9e71b8c 100644 --- a/src/masto/clients.ts +++ b/src/masto/clients.ts @@ -69,7 +69,7 @@ export function useSessions() { return sessions; } -function useSessionsRw() { +export function useSessionsRw() { const store = useContext(Context); if (!store) { throw new TypeError("sessions are not provided"); diff --git a/src/material/BottomSheet.module.css b/src/material/BottomSheet.module.css deleted file mode 100644 index 1a15849..0000000 --- a/src/material/BottomSheet.module.css +++ /dev/null @@ -1,32 +0,0 @@ -.bottomSheet { - composes: surface from 'material.module.css'; - border: none; - position: absolute; - left: 50%; - top: 50%; - transform: translate(-50%, -50%); - padding: 0; - width: 100%; - max-width: 560px; - border-radius: 2px; - overscroll-behavior: contain; - - box-shadow: var(--tutu-shadow-e16); - - :global(.MuiToolbar-root) > :global(.MuiButtonBase-root):first-child { - color: white; - margin-left: -0.5em; - margin-right: 24px; - } - - @media (max-width: 560px) { - & { - left: 0; - top: 0; - transform: none; - bottom: 0; - height: 100vh; - height: 100dvh; - } - } -} \ No newline at end of file diff --git a/src/material/BottomSheet.tsx b/src/material/BottomSheet.tsx deleted file mode 100644 index 112a17e..0000000 --- a/src/material/BottomSheet.tsx +++ /dev/null @@ -1,26 +0,0 @@ -import { createEffect, type ParentComponent } from "solid-js"; -import styles from './BottomSheet.module.css' - -export type BottomSheetProps = { - open?: boolean; -}; - -const BottomSheet: ParentComponent = (props) => { - let element: HTMLDialogElement; - - createEffect(() => { - if (props.open) { - if (!element.open) { - element.showModal(); - } - } else { - if (element.open) { - element.close(); - } - } - }); - - return {props.children}; -}; - -export default BottomSheet; diff --git a/src/material/Scaffold.tsx b/src/material/Scaffold.tsx index f1f9d34..d7a1344 100644 --- a/src/material/Scaffold.tsx +++ b/src/material/Scaffold.tsx @@ -22,6 +22,9 @@ const Scaffold: ParentComponent = (props) => { css` .scaffold-content { --scaffold-topbar-height: ${(topbarSize.height?.toString() ?? 0) + "px"}; + + height: 100%; + width: 100%; } .topbar { diff --git a/src/overrides.d.ts b/src/overrides.d.ts deleted file mode 100644 index fc32e50..0000000 --- a/src/overrides.d.ts +++ /dev/null @@ -1,10 +0,0 @@ -/// - -interface ImportMetaEnv { - readonly BUILT_AT: string; - readonly PACKAGE_VERSION: string; -} - -interface ImportMeta { - readonly env: ImportMetaEnv; -} diff --git a/src/settings/Settings.tsx b/src/settings/Settings.tsx deleted file mode 100644 index e93de43..0000000 --- a/src/settings/Settings.tsx +++ /dev/null @@ -1,137 +0,0 @@ -import { createResource, For, type ParentComponent } from "solid-js"; -import Scaffold from "../material/Scaffold.js"; -import { - AppBar, - Divider, - IconButton, - List, - ListItem, - ListItemButton, - ListItemSecondaryAction, - ListItemText, - ListSubheader, - NativeSelect, - Select, - Switch, - Toolbar, -} from "@suid/material"; -import { Close as CloseIcon } from "@suid/icons-material"; -import { useNavigate } from "@solidjs/router"; -import { Title } from "../material/typography.jsx"; -import { useSessions } from "../masto/clients.js"; -import { css } from "solid-styled"; -import { useSignedInProfiles } from "../masto/acct.js"; -import { signOut, type Account } from "../accounts/stores.js"; -import { intlFormat } from "date-fns"; - -const Settings: ParentComponent = () => { - const navigate = useNavigate(); - - const [profiles] = useSignedInProfiles(); - - const doSignOut = (acct: Account) => { - signOut((a) => a.site === acct.site && a.accessToken === acct.accessToken); - }; - - css` - ul { - padding: 0; - } - - .setting-list { - padding-bottom: calc(env(safe-area-inset-bottom, 0px) + 16px); - } - `; - return ( - - - - - - Settings - - - } - > - -
  • -
      - Accounts - - All Notifications - - - - - - Sign in... - -
    - - {({ account: acct, inf }) => ( -
      - {`@${inf?.username ?? "..."}@${new URL(acct.site).host}`} - - Notifications - - - - - - Sign out - -
    - )} -
    -
  • -
  • - Reading - - Fonts - - - - Prefetch Toots - - - - - -
  • -
  • - Controls - - Optimized UI - - - - - - - - - -
  • -
  • - This Application - - - About Tutu - - - - - No updates - - -
  • -
    -
    - ); -}; - -export default Settings; diff --git a/src/timelines/Home.tsx b/src/timelines/Home.tsx index 0738a37..16fa2e1 100644 --- a/src/timelines/Home.tsx +++ b/src/timelines/Home.tsx @@ -6,11 +6,9 @@ import { Show, untrack, onMount, - type ParentComponent, - children, } from "solid-js"; import { useDocumentTitle } from "../utils"; -import { useSessions } from "../masto/clients"; +import { useSessions } from "../masto/clients"; import { type mastodon } from "masto"; import Scaffold from "../material/Scaffold"; import { @@ -34,7 +32,6 @@ import Tab from "../material/Tab"; import { Create as CreateTootIcon } from "@suid/icons-material"; import { useTimeline } from "../masto/timelines"; import { makeEventListener } from "@solid-primitives/event-listener"; -import BottomSheet from "../material/BottomSheet"; const TimelinePanel: Component<{ client: mastodon.rest.Client; @@ -148,7 +145,7 @@ const TimelinePanel: Component<{ ); }; -const Home: ParentComponent = (props) => { +const Home: Component = () => { let panelList: HTMLDivElement; useDocumentTitle("Timelines"); const now = createTimeSource(); @@ -165,8 +162,6 @@ const Home: ParentComponent = (props) => { number, ]); - const child = children(() => props.children) - let scrollEventLockReleased = true; const recalculateTabIndicator = () => { @@ -226,7 +221,7 @@ const Home: ParentComponent = (props) => { const onTabClick = (idx: number) => { const items = panelList.querySelectorAll(".tab-panel"); if (items.length > idx) { - items.item(idx).scrollIntoView({ block: "nearest", behavior: "smooth" }); + items.item(idx).scrollIntoView({ behavior: "smooth" }); } }; @@ -240,6 +235,10 @@ const Home: ParentComponent = (props) => { max-height: calc(100dvh - var(--scaffold-topbar-height, 0px)); scroll-snap-align: center; + &:not(.active) { + overflow: hidden; + } + @media (max-width: 600px) { padding: 0; } @@ -262,74 +261,71 @@ const Home: ParentComponent = (props) => { `; return ( - <> - - - - - Home - - - Trending - - - Public - - - - setPrefetching((x) => !x)}> - Prefetch Toots - - - - - - - - } - fab={ - - - - } - > - -
    -
    -
    - -
    + + + + + Home + + + Trending + + + Public + + + + setPrefetching((x) => !x)}> + Prefetch Toots + + + + + + + + } + fab={ + + + + } + > + +
    +
    +
    +
    -
    -
    - -
    -
    -
    -
    - -
    -
    -
    - - {child()} - - +
    +
    + +
    +
    +
    +
    + +
    +
    +
    +
    +
    +
    ); }; diff --git a/src/timelines/ProfileMenuButton.tsx b/src/timelines/ProfileMenuButton.tsx index b997041..1d61553 100644 --- a/src/timelines/ProfileMenuButton.tsx +++ b/src/timelines/ProfileMenuButton.tsx @@ -15,7 +15,6 @@ import { Star as LikeIcon, FeaturedPlayList as ListIcon, } from "@suid/icons-material"; -import { A } from "@solidjs/router"; const ProfileMenuButton: ParentComponent<{ profile?: { displayName: string; avatar: string; username: string }; @@ -108,7 +107,7 @@ const ProfileMenuButton: ParentComponent<{ {props.children} - + diff --git a/vite.config.ts b/vite.config.ts index 26d01b6..96cb481 100644 --- a/vite.config.ts +++ b/vite.config.ts @@ -3,7 +3,6 @@ import solid from "vite-plugin-solid"; import solidStyled from "vite-plugin-solid-styled"; import suid from "@suid/vite-plugin"; import { VitePWA } from "vite-plugin-pwa"; -import version from "vite-plugin-package-version"; export default defineConfig(({ mode }) => ({ plugins: [ @@ -18,11 +17,7 @@ export default defineConfig(({ mode }) => ({ VitePWA({ registerType: "autoUpdate", }), - version(), ], - define: { - "import.meta.env.BUILT_AT": `"${new Date().toISOString()}"`, - }, css: { devSourcemap: true, },