-
Notifications
You must be signed in to change notification settings - Fork 1
feat: Extract UI components from trakli/webui with Nuxt playground explorer #1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
Lantum-Brendan
wants to merge
14
commits into
trakli:master
Choose a base branch
from
Lantum-Brendan:feat/extract-components-from-trakli-webui
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 7 commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
487bf70
feat: Extract UI components from trakli/webui with Nuxt playground ex…
Lantum-Brendan 31aa5b4
test: Fix Cypress component tests (event listener + asset path assert…
Lantum-Brendan 8aa3dc6
fix: Inline SVG assets and use design tokens for themeability
Lantum-Brendan 227ddfc
fix: replace hardcoded hex with design tokens and dogfood kit compone…
Lantum-Brendan 33bf10a
fix: add demo configs for GoogleIcon and SettingsDisplay in playgroun…
Lantum-Brendan de17fee
docs: update README to reflect shipped components
Lantum-Brendan 27398ca
refactor(components): extract structural T* primitives and migrate do…
Lantum-Brendan 6932fe9
fix: remove hardcoded currency rates from TTableComponent, add conver…
Lantum-Brendan 57e848d
fix: update CI workflow to use Node 22 LTS instead of deprecated Node 20
Lantum-Brendan fdfeb8f
fix: add legacy CSS class names to T* components for backward-compati…
Lantum-Brendan 6cde7fa
feat: migrate Tier A AI chat blocks and onboarding wizard
Lantum-Brendan c67be3c
feat: migrate Tier B AI and import components
Lantum-Brendan 2fc3d8f
fix: ImportSessionsList badge function and demo data
Lantum-Brendan 8483ff3
fix: add missing T* component demos and overflow containment
Lantum-Brendan File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
| @@ -0,0 +1,142 @@ | ||||||
| <script setup> | ||||||
| import { computed, ref, h, onErrorCaptured, markRaw } from 'vue'; | ||||||
| import { components, getDemo, slottedComponents } from '../registry'; | ||||||
| import UsageLanding from './UsageLanding.vue'; | ||||||
|
|
||||||
| const props = defineProps({ | ||||||
| selected: { type: String, default: '' } | ||||||
| }); | ||||||
|
|
||||||
| defineEmits(['select-category']); | ||||||
|
|
||||||
| const meta = computed(() => components.find((c) => c.name === props.selected) || null); | ||||||
| const isSlotted = computed(() => meta.value && slottedComponents.has(meta.value.name)); | ||||||
| const demo = computed(() => (meta.value ? getDemo(meta.value.name) : { props: {} })); | ||||||
|
|
||||||
| // Per-render error boundary: a single component that throws during render | ||||||
| // must not take down the whole dashboard (which forced a manual refresh). | ||||||
| const renderError = ref(null); | ||||||
|
|
||||||
| onErrorCaptured((err) => { | ||||||
| renderError.value = err && err.message ? err.message : String(err); | ||||||
| return false; | ||||||
| }); | ||||||
|
|
||||||
| // Reset any prior error whenever the selection changes. | ||||||
| const selectedKey = computed(() => props.selected); | ||||||
| import { watch } from 'vue'; | ||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Move this import to the top of the script block to follow standard style guides and improve readability.
Suggested change
|
||||||
| watch(selectedKey, () => { renderError.value = null; }); | ||||||
| </script> | ||||||
|
|
||||||
| <template> | ||||||
| <div v-if="!meta" class="usage-wrap"> | ||||||
| <UsageLanding @select-category="$emit('select-category', $event)" /> | ||||||
| </div> | ||||||
|
|
||||||
| <div v-else-if="renderError" class="error-hint"> | ||||||
| <h3>This component could not be previewed</h3> | ||||||
| <p>{{ meta.name }} threw during render:</p> | ||||||
| <pre>{{ renderError }}</pre> | ||||||
| <p class="error-hint__note"> | ||||||
| It likely needs a data shape (e.g. a <code>budget</code>/<code>party</code>/<code>wallet</code> | ||||||
| object) not yet provided in the playground registry. | ||||||
| </p> | ||||||
| </div> | ||||||
|
|
||||||
| <!-- Slotted / composite demos need real template fragments --> | ||||||
| <div v-else-if="isSlotted" class="demo"> | ||||||
| <div v-if="meta.name === 'TButton'" class="btn-row"> | ||||||
| <TButton text="Primary" variant="primary" :full-width="false" /> | ||||||
| <TButton text="Secondary" variant="secondary" :full-width="false" /> | ||||||
| <TButton text="Outline" variant="outline" :full-width="false" /> | ||||||
| <TButton text="Loading" loading :full-width="false" /> | ||||||
| <TButton text="Disabled" disabled :full-width="false" /> | ||||||
| </div> | ||||||
|
|
||||||
| <TCard v-else-if="meta.name === 'TCard'" title="Card title">Card body content</TCard> | ||||||
|
|
||||||
| <TInfoButton v-else-if="meta.name === 'TInfoButton'" text="Info" :full-width="false" /> | ||||||
|
|
||||||
| <TContainer v-else-if="meta.name === 'TContainer'"> | ||||||
| <TStack> | ||||||
| <TCard title="Stacked">One</TCard> | ||||||
| <TCard title="Stacked">Two</TCard> | ||||||
| </TStack> | ||||||
| </TContainer> | ||||||
|
|
||||||
| <TStack v-else-if="meta.name === 'TStack'"> | ||||||
| <TCard title="Stacked">One</TCard> | ||||||
| <TCard title="Stacked">Two</TCard> | ||||||
| </TStack> | ||||||
|
|
||||||
| <TGrid v-else-if="meta.name === 'TGrid'"> | ||||||
| <TCard title="Grid">A</TCard> | ||||||
| <TCard title="Grid">B</TCard> | ||||||
| </TGrid> | ||||||
|
|
||||||
| <TSplit v-else-if="meta.name === 'TSplit'"> | ||||||
| <template #master><TCard title="Master">M</TCard></template> | ||||||
| <template #detail><TCard title="Detail">D</TCard></template> | ||||||
| </TSplit> | ||||||
|
|
||||||
| <TPanel v-else-if="meta.name === 'TPanel'" title="Panel">Panel content</TPanel> | ||||||
|
|
||||||
| <TPageShell v-else-if="meta.name === 'TPageShell'" title="Page shell"> | ||||||
| <TCard title="Inside">Shell body</TCard> | ||||||
| </TPageShell> | ||||||
|
|
||||||
| <TDropdown v-else-if="meta.name === 'TDropdown'" text="Menu" :full-width="false"> | ||||||
| <TDropdownItem text="Action one" /> | ||||||
| <TDropdownItem text="Action two" /> | ||||||
| </TDropdown> | ||||||
|
|
||||||
| <TTabs v-else-if="meta.name === 'TTabs'" v-bind="demo.props"> | ||||||
| <template #first><TCard title="First">First panel</TCard></template> | ||||||
| <template #second><TCard title="Second">Second panel</TCard></template> | ||||||
| </TTabs> | ||||||
|
|
||||||
| <CollapsibleSection v-else-if="meta.name === 'CollapsibleSection'" title="Section"> | ||||||
| Collapsible content | ||||||
| </CollapsibleSection> | ||||||
| </div> | ||||||
|
|
||||||
| <!-- Generic: render with demo props --> | ||||||
| <div v-else class="demo"> | ||||||
| <component :is="meta.component" v-bind="demo.props" /> | ||||||
| </div> | ||||||
| </template> | ||||||
|
|
||||||
| <style scoped> | ||||||
| .demo { | ||||||
| padding: 2rem; | ||||||
| } | ||||||
| .btn-row { | ||||||
| display: flex; | ||||||
| flex-wrap: wrap; | ||||||
| gap: 0.75rem; | ||||||
| align-items: center; | ||||||
| } | ||||||
| .usage-wrap { | ||||||
| padding: 1rem 0; | ||||||
| } | ||||||
| .error-hint { | ||||||
| padding: 2rem; | ||||||
| color: var(--color-error-dark); | ||||||
| } | ||||||
| .error-hint h3 { | ||||||
| margin-top: 0; | ||||||
| } | ||||||
| .error-hint pre { | ||||||
| background: rgba(var(--color-error-rgb), 0.08); | ||||||
| border: 1px solid rgba(var(--color-error-rgb), 0.2); | ||||||
| border-radius: 0.5rem; | ||||||
| padding: 0.75rem 1rem; | ||||||
| overflow-x: auto; | ||||||
| font-size: 0.8rem; | ||||||
| white-space: pre-wrap; | ||||||
| } | ||||||
| .error-hint__note { | ||||||
| color: var(--color-text-muted); | ||||||
| font-size: 0.85rem; | ||||||
| } | ||||||
| </style> | ||||||
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.