Skip to content

fix(ui): pre-register 4 bot brand SVGs locally so picker renders offline - #249

Merged
jackwener merged 1 commit into
mainfrom
yuejing/bot-logos-offline-partial
Jun 25, 2026
Merged

fix(ui): pre-register 4 bot brand SVGs locally so picker renders offline#249
jackwener merged 1 commit into
mainfrom
yuejing/bot-logos-offline-partial

Conversation

@jackwener

Copy link
Copy Markdown
Member

Summary

Acts on @kenji audit msg `e4cfbfb0` round-2 #2 (`#my-ai:c28a6293` thread).

The bot logo picker used `<IconifyIcon icon="simple-icons:telegram">` etc., which lazy-fetches from `api.iconify.design` at runtime. On cold-offline Electron launches or firewalled networks the logos degraded to the monogram fallback. Desktop brand logos shouldn't depend on a third-party CDN.

Partial offline fix landing 4 of 6 brands today:

  • packages/ui/src/bot-brand-icons.ts ships the SVG <path> bodies for telegram / wechat / discord / qq, copied verbatim from upstream Simple Icons (CC0). Provenance + pinned upstream version documented inline.
  • icons.tsx registers them as a local Iconify collection under the maka-bot:* prefix at module load.
  • BOT_BRAND updated: telegram, wechat, wecom, discord, qq now point at maka-bot:*.

Honest gap (documented inline): feishu/lark and dingtalk are not (and never were) carried by Simple Icons under those names. They still use simple-icons:* CDN lazy fetch with the colored-tile + glyph offline fallback. Sourcing those two from each brand's official kit is a separate follow-up so this PR's SVG provenance stays auditable. kenji's contract goal (zero simple-icons:* ids) is partially met.

No new runtime deps. @iconify-json/simple-icons was used only as a local one-shot extraction source.

Test plan

  • tsc --noEmit -p apps/desktop/tsconfig.renderer.json — clean on touched files.
  • pnpm -F @maka/ui build — clean.
  • Pull network cable, restart Maka, open Settings → 机器人对话: Telegram / WeChat / WeCom / Discord / QQ render real logos. Feishu / DingTalk show colored tile + glyph (documented gap).
  • Same offline, open Plan Reminder → 平台 select: same 4 brands show real logos in trigger + items.

…offline

@kenji audit msg `e4cfbfb0` round-2 #2: the bot logo picker was
rendering through `<IconifyIcon icon="simple-icons:telegram">` etc.,
which Iconify lazy-fetches from `api.iconify.design` at runtime. On
cold-offline Electron launches (or firewalled networks) the logos
silently degraded to the `glyph` monogram fallback. Desktop brand
logos should not depend on a third-party CDN at runtime.

Ship a partial offline fix that covers 4 of the 6 brands today:

- New `packages/ui/src/bot-brand-icons.ts` holds the verbatim SVG
  `<path>` bodies for telegram / wechat / discord / qq, each copied
  from upstream Simple Icons (CC0) at the version where the icon was
  last published (1.2.87 for the first three; 1.2.10 for `tencentqq`
  before Simple Icons retired the standalone QQ id).
- `icons.tsx` registers these as a local Iconify collection under the
  `maka-bot:*` prefix at module load via `addCollection`, mirroring the
  existing `addCollection(phData)` Phosphor registration so `<Icon
  icon="maka-bot:telegram">` resolves synchronously without any
  network roundtrip.
- `BOT_BRAND` points telegram, wechat, wecom, discord, qq at
  `maka-bot:*`.

Honest gap (documented in both `bot-brand.ts` and `bot-brand-icons.ts`):
feishu/lark and dingtalk are not (and never were) carried by Simple
Icons under those names, so they still fall through `simple-icons:*`
CDN lazy fetch with the colored-tile + glyph offline fallback. Sourcing
them from each brand's official kit is a separate follow-up so this
PR's SVG provenance stays auditable; until then, kenji's contract goal
(no `simple-icons:*` ids at all) is partially met.

No new runtime deps. `@iconify-json/simple-icons` was used only as a
local one-shot extraction source and is not added to `packages/ui`'s
`dependencies`.
@jackwener
jackwener merged commit af66ebb into main Jun 25, 2026
@jackwener
jackwener deleted the yuejing/bot-logos-offline-partial branch June 25, 2026 09:57
jackwener added a commit that referenced this pull request Jun 25, 2026
… dvh (#250)

@kenji audit msg `232aec0f` (`#my-ai:c28a6293`). Round 3 against
`af66ebb7` post-#249.

**#2 — Plan Reminder select collapsed state was text-only.**
PR #247 added a brand icon to each `<SelectItem>`, but `<SelectValue
/>` defaulted to rendering just the label string — open dropdown
showed a logo, collapsed trigger showed plain text. Build a
`value → { label, icon }` lookup inside `PlanReminderSelect` and pass
a function-child to `SelectValue` so the picked state renders the same
icon + label row the dropdown items render.

**#6 — `100vh` residue in renderer CSS.**
Four sites still on `100vh`:
- `maka-tokens.css:760` `.maka-shell` `height`
- `maka-tokens.css:1941` `.maka-modal` `max-height: calc(100vh - 80px)`
- `styles.css:5028` `.maka-help-modal` `max-height: calc(100vh - 96px)`
- `styles.css:13121` `.maka-onboarding-stack` `min-height: calc(100vh - 84px)`

Replace each with `100dvh` so Electron browser frames with dynamic
chrome (or a future mobile-style viewport) don't get half a viewport
of height calculation drift. Other renderer surfaces already use
`100dvh`; this brings the legacy four into line.

Deferred per kenji's own scope:
- **#1** feishu/dingtalk official-brand-kit sourcing — separate PR.
- **#3 / #4** SettingsSelect / Segmented / ChoiceCard primitive
  unification — design-system refactor; no end-result delta on its
  own.
- **#5** layout-property transitions in sidebar/tabs/accordion —
  kenji explicitly gated on visual smoke harness.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant