Skip to content

Commit

Permalink
[website] Re-enable embeds (#4201)
Browse files Browse the repository at this point in the history
Fixes #4176

Turns out the language pack was missing.
  • Loading branch information
paullewis authored Jan 24, 2025
1 parent 9ba6ea3 commit 032cf64
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 8 deletions.
6 changes: 6 additions & 0 deletions .changeset/clean-months-burn.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
"@breadboard-ai/shared-ui": patch
"@google-labs/breadboard-website": patch
---

Re-enable embeds
2 changes: 1 addition & 1 deletion packages/shared-ui/src/elements/editor/editor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1532,7 +1532,7 @@ export class Editor extends LitElement implements DragConnectorReceiver {
}

const content = html`<div id="content">
${this.graph
${this.graph && !this.readOnly
? html`<div id="floating-buttons">
<div id="start">
<button
Expand Down
34 changes: 28 additions & 6 deletions packages/shared-ui/src/strings/helper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@ import { LanguagePack, LanguagePackEntry } from "../types/types";
class Strings<T extends LanguagePackEntry> {
constructor(
private name: string,
private values: T
private values: T,
private warnIfMissing = false
) {}

from(key: string) {
Expand All @@ -21,9 +22,11 @@ class Strings<T extends LanguagePackEntry> {
return this.values[key].str;
}

console.warn(
`Missing language pack key "${key}" from section ${this.name}`
);
if (this.warnIfMissing) {
console.warn(
`Missing language pack key "${key}" from section ${this.name}`
);
}
return key.toUpperCase();
}
}
Expand All @@ -34,12 +37,31 @@ export async function initFrom(language: LanguagePack) {
}

export function forSection<T extends keyof LanguagePack>(section: T) {
if (!currentLanguage) {
currentLanguage = {
ActivityLog: {},
AppPreview: {},
CommandPalette: {},
ComponentSelector: {},
Editor: {},
Global: {},
KitSelector: {},
ProjectListing: {},
UIController: {},
WorkspaceOutline: {},
};
}
return new Strings(section, currentLanguage[section]);
}

export function from<T extends LanguagePack, Y extends keyof T>(
lib: T,
name: Y
name: Y,
warnIfMissing = false
) {
return new Strings(name as string, lib[name] as LanguagePackEntry);
return new Strings(
name as string,
lib[name] as LanguagePackEntry,
warnIfMissing
);
}
2 changes: 1 addition & 1 deletion packages/website/src/js/board-embed.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
* Copyright 2024 Google LLC
* SPDX-License-Identifier: Apache-2.0
*/

import { LitElement, html, css, TemplateResult, nothing } from "lit";
import { customElement, property } from "lit/decorators.js";
import { cache } from "lit/directives/cache.js";
Expand All @@ -13,7 +14,6 @@ import TemplateKit from "@google-labs/template-kit";
import GeminiKit from "@google-labs/gemini-kit";
import AgentKit from "@google-labs/agent-kit/agent.kit.json" assert { type: "json" };

import "@breadboard-ai/shared-ui/editor";
import "@breadboard-ai/shared-ui/editor";

import {
Expand Down

0 comments on commit 032cf64

Please sign in to comment.