Add a config option to disable home link in embeds#986
Conversation
✅ Deploy Preview for livecodes ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
|
|
Size Change: 0 B Total Size: 1.09 MB ℹ️ View Unchanged
|
WalkthroughThis PR adds a new ChangesdisableHomeLink Configuration Feature
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Possibly related issues
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
🧹 Nitpick comments (2)
src/livecodes/core.ts (1)
5040-5040: ⚡ Quick winExternalize the new tooltip/title string for i18n.
Line 5040 introduces a hardcoded user-facing string. Please route it through
translateString(and add the locale key) to keep embed UI text localizable.Suggested patch
- logoLink.title = 'LiveCodes'; + logoLink.title = window.deps.translateString('generic.embed.logoTitle', 'LiveCodes');As per coding guidelines,
src/livecodes/**/*.{ts,tsx,html}should “Export user-facing text strings for internationalization; run npm run i18n-export after adding new text”.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@src/livecodes/core.ts` at line 5040, Replace the hardcoded title assignment logoLink.title = 'LiveCodes' in src/livecodes/core.ts with a call to translateString (e.g., logoLink.title = translateString('livecodes.logo.title')), add the new locale key "livecodes.logo.title" and its string to your i18n source (messages/*.json or equivalent), ensure translateString is imported where logoLink is set, and run npm run i18n-export to include the new text in the project extraction.storybook/solid/src/solid.ts (1)
12-14: 💤 Low valueConsider using inline type modifier to avoid the eslint-disable.
The current approach splits runtime and type imports from
livecodesinto separate statements, requiring an eslint-disable comment. TypeScript supports inlinetypemodifiers that would satisfy both the type-only import requirement and import grouping:♻️ Refactor to consolidate imports
-import { createPlayground } from 'livecodes'; -// eslint-disable-next-line import/order -import type { EmbedOptions, Playground } from 'livecodes'; +import { createPlayground, type EmbedOptions, type Playground } from 'livecodes';🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@storybook/solid/src/solid.ts` around lines 12 - 14, The import split causes an eslint-disable; consolidate the imports by importing the runtime symbol createPlayground and the type-only symbols EmbedOptions and Playground in a single statement using TypeScript's inline type modifier (e.g., import createPlayground, { type EmbedOptions, type Playground } from 'livecodes') so you can remove the eslint-disable comment; update the import that currently references createPlayground and the separate type import to a single combined import for createPlayground, EmbedOptions, and Playground.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Nitpick comments:
In `@src/livecodes/core.ts`:
- Line 5040: Replace the hardcoded title assignment logoLink.title = 'LiveCodes'
in src/livecodes/core.ts with a call to translateString (e.g., logoLink.title =
translateString('livecodes.logo.title')), add the new locale key
"livecodes.logo.title" and its string to your i18n source (messages/*.json or
equivalent), ensure translateString is imported where logoLink is set, and run
npm run i18n-export to include the new text in the project extraction.
In `@storybook/solid/src/solid.ts`:
- Around line 12-14: The import split causes an eslint-disable; consolidate the
imports by importing the runtime symbol createPlayground and the type-only
symbols EmbedOptions and Playground in a single statement using TypeScript's
inline type modifier (e.g., import createPlayground, { type EmbedOptions, type
Playground } from 'livecodes') so you can remove the eslint-disable comment;
update the import that currently references createPlayground and the separate
type import to a single combined import for createPlayground, EmbedOptions, and
Playground.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro
Run ID: d1e2e22a-989c-4a50-8c45-5617a0547124
📒 Files selected for processing (16)
docs/docs/configuration/configuration-object.mdxdocs/docs/contribution/config-system.mdxsrc/livecodes/config/config.tssrc/livecodes/config/default-config.tssrc/livecodes/config/validate-config.tssrc/livecodes/core.tssrc/sdk/models.tsstorybook/_stories/EmbedOptions/config.tsstorybook/common/arg-types.tsstorybook/preact/stories/EmbedOptions/config.stories.tsstorybook/react/stories/EmbedOptions/config.stories.tsstorybook/solid/src/solid.tsstorybook/solid/stories/EmbedOptions/config.stories.tsstorybook/svelte/stories/EmbedOptions/config.stories.tsstorybook/vue/stories/EmbedOptions/config.stories.tsstorybook/web-components/stories/EmbedOptions/config.stories.ts


What type of PR is this? (check all applicable)
Description
A new config option
disableHomeLinkwas added, which if set totruedisables the link on LiveCodes logo ("Edit in LiveCodes") in embeds.Related Tickets & Documents
#985 #980
Added to documentations?
Summary by CodeRabbit
New Features
disableHomeLinkconfiguration option to disable the "Edit on LiveCodes" logo link in embedded playgrounds (defaults tofalse).Documentation
disableHomeLinkconfiguration option.