@wakastellar/ui 2.3.4 → 2.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/blocks/dashboard/index.d.ts +4 -1
- package/dist/blocks/empty-states/index.d.ts +4 -1
- package/dist/blocks/error-pages/index.d.ts +4 -1
- package/dist/blocks/index.d.ts +1 -1
- package/dist/blocks/landing/index.d.ts +4 -1
- package/dist/blocks/pricing/index.d.ts +5 -1
- package/dist/blocks/sidebar/index.d.ts +5 -1
- package/dist/index.cjs.js +130 -130
- package/dist/index.d.ts +1 -0
- package/dist/index.es.js +7905 -7856
- package/dist/stories/Button.d.ts +14 -0
- package/dist/stories/Button.stories.d.ts +8 -0
- package/dist/stories/Header.d.ts +11 -0
- package/dist/stories/Header.stories.d.ts +6 -0
- package/dist/stories/Page.d.ts +2 -0
- package/dist/stories/Page.stories.d.ts +6 -0
- package/dist/types/index.d.ts +1 -0
- package/dist/types/link.d.ts +23 -0
- package/package.json +11 -3
- package/src/blocks/activity-timeline/ActivityTimeline.stories.tsx +460 -0
- package/src/blocks/apm-overview/APMOverview.stories.tsx +435 -0
- package/src/blocks/auth-2fa/Auth2FA.stories.tsx +308 -0
- package/src/blocks/calendar-view/CalendarView.stories.tsx +398 -0
- package/src/blocks/chat/Chat.stories.tsx +466 -0
- package/src/blocks/chat-interface/ChatInterface.stories.tsx +412 -0
- package/src/blocks/checkout-flow/CheckoutFlow.stories.tsx +408 -0
- package/src/blocks/cicd-builder/CICDBuilder.stories.tsx +499 -0
- package/src/blocks/cloud-cost-dashboard/CloudCostDashboard.stories.tsx +356 -0
- package/src/blocks/container-orchestrator/ContainerOrchestrator.stories.tsx +461 -0
- package/src/blocks/dashboard/Dashboard.stories.tsx +559 -0
- package/src/blocks/dashboard/index.tsx +68 -27
- package/src/blocks/dashboard-kpi/DashboardKPI.stories.tsx +422 -0
- package/src/blocks/database-admin/DatabaseAdmin.stories.tsx +393 -0
- package/src/blocks/deployment-dashboard/DeploymentDashboard.stories.tsx +457 -0
- package/src/blocks/empty-states/EmptyStates.stories.tsx +467 -0
- package/src/blocks/empty-states/index.tsx +26 -8
- package/src/blocks/error-pages/ErrorPages.stories.tsx +401 -0
- package/src/blocks/error-pages/index.tsx +26 -8
- package/src/blocks/faq/FAQ.stories.tsx +416 -0
- package/src/blocks/file-manager/FileManager.stories.tsx +413 -0
- package/src/blocks/footer/Footer.stories.tsx +328 -0
- package/src/blocks/gitops-sync-status/GitOpsSyncStatus.stories.tsx +529 -0
- package/src/blocks/header/WakaHeader.stories.tsx +455 -0
- package/src/blocks/headtab/Headtab.stories.tsx +369 -0
- package/src/blocks/i18n-editor/I18nEditor.stories.tsx +451 -0
- package/src/blocks/incident-manager/IncidentManager.stories.tsx +464 -0
- package/src/blocks/index.ts +1 -1
- package/src/blocks/infrastructure-map/InfrastructureMap.stories.tsx +533 -0
- package/src/blocks/kanban-board/KanbanBoard.stories.tsx +494 -0
- package/src/blocks/landing/WakaLanding.stories.tsx +449 -0
- package/src/blocks/landing/index.tsx +125 -66
- package/src/blocks/language-selector/LanguageSelector.stories.tsx +345 -0
- package/src/blocks/layout/Layout.stories.tsx +373 -0
- package/src/blocks/login/Login.stories.tsx +443 -0
- package/src/blocks/on-call-schedule/OnCallSchedule.stories.tsx +381 -0
- package/src/blocks/player-profile/PlayerProfile.stories.tsx +316 -0
- package/src/blocks/pricing/WakaPricing.stories.tsx +530 -0
- package/src/blocks/pricing/index.tsx +38 -4
- package/src/blocks/profile/Profile.stories.tsx +371 -0
- package/src/blocks/release-notes/ReleaseNotes.stories.tsx +431 -0
- package/src/blocks/settings/Settings.stories.tsx +520 -0
- package/src/blocks/sidebar/WakaSidebar.stories.tsx +513 -0
- package/src/blocks/sidebar/index.tsx +49 -20
- package/src/blocks/theme-creator-block/ThemeCreatorBlock.stories.tsx +370 -0
- package/src/blocks/user-management/UserManagement.stories.tsx +411 -0
- package/src/blocks/wizard/Wizard.stories.tsx +683 -0
- package/src/components/accordion/Accordion.stories.tsx +93 -0
- package/src/components/alert/Alert.stories.tsx +95 -0
- package/src/components/alert-dialog/AlertDialog.stories.tsx +126 -0
- package/src/components/aspect-ratio/AspectRatio.stories.tsx +118 -0
- package/src/components/avatar/Avatar.stories.tsx +104 -0
- package/src/components/button/Button.stories.tsx +12 -1
- package/src/components/calendar/Calendar.stories.tsx +102 -0
- package/src/components/card/Card.stories.tsx +125 -0
- package/src/components/checkbox/Checkbox.stories.tsx +100 -0
- package/src/components/code/Code.stories.tsx +402 -0
- package/src/components/collapsible/Collapsible.stories.tsx +123 -0
- package/src/components/command/Command.stories.tsx +207 -0
- package/src/components/context-menu/ContextMenu.stories.tsx +220 -0
- package/src/components/dialog/Dialog.stories.tsx +157 -0
- package/src/components/dropdown-menu/DropdownMenu.stories.tsx +225 -0
- package/src/components/form/Form.stories.tsx +413 -0
- package/src/components/hover-card/HoverCard.stories.tsx +148 -0
- package/src/components/input-otp/InputOTP.stories.tsx +255 -0
- package/src/components/label/Label.stories.tsx +68 -0
- package/src/components/menubar/Menubar.stories.tsx +278 -0
- package/src/components/navigation-menu/NavigationMenu.stories.tsx +202 -0
- package/src/components/popover/Popover.stories.tsx +199 -0
- package/src/components/progress/Progress.stories.tsx +104 -0
- package/src/components/radio-group/RadioGroup.stories.tsx +138 -0
- package/src/components/scroll-area/ScrollArea.stories.tsx +153 -0
- package/src/components/select/Select.stories.tsx +146 -0
- package/src/components/separator/Separator.stories.tsx +117 -0
- package/src/components/sheet/Sheet.stories.tsx +195 -0
- package/src/components/skeleton/Skeleton.stories.tsx +114 -0
- package/src/components/slider/Slider.stories.tsx +157 -0
- package/src/components/switch/Switch.stories.tsx +114 -0
- package/src/components/table/Table.stories.tsx +153 -0
- package/src/components/tabs/Tabs.stories.tsx +155 -0
- package/src/components/textarea/Textarea.stories.tsx +116 -0
- package/src/components/toast/Toast.stories.tsx +160 -0
- package/src/components/toggle/Toggle.stories.tsx +125 -0
- package/src/components/tooltip/Tooltip.stories.tsx +133 -0
- package/src/components/typography/Typography.stories.tsx +207 -0
- package/src/components/waka-3d-pie-chart/Waka3DPieChart.stories.tsx +308 -0
- package/src/components/waka-achievement-unlock/WakaAchievementUnlock.stories.tsx +353 -0
- package/src/components/waka-artifact-list/WakaArtifactList.stories.tsx +258 -0
- package/src/components/waka-autocomplete/WakaAutocomplete.stories.tsx +224 -0
- package/src/components/waka-badge-showcase/WakaBadgeShowcase.stories.tsx +269 -0
- package/src/components/waka-barcode/WakaBarcode.stories.tsx +227 -0
- package/src/components/waka-bottom-sheet/WakaBottomSheet.stories.tsx +408 -0
- package/src/components/waka-breadcrumb/WakaBreadcrumb.stories.tsx +237 -0
- package/src/components/waka-build-matrix/WakaBuildMatrix.stories.tsx +328 -0
- package/src/components/waka-carousel/WakaCarousel.stories.tsx +296 -0
- package/src/components/waka-charts/WakaCharts.stories.tsx +519 -0
- package/src/components/waka-color-picker/WakaColorPicker.stories.tsx +200 -0
- package/src/components/waka-combobox/WakaCombobox.stories.tsx +250 -0
- package/src/components/waka-container-list/WakaContainerList.stories.tsx +315 -0
- package/src/components/waka-contribution-graph/WakaContributionGraph.stories.tsx +354 -0
- package/src/components/waka-cost-breakdown/WakaCostBreakdown.stories.tsx +348 -0
- package/src/components/waka-daily-reward/WakaDailyReward.stories.tsx +365 -0
- package/src/components/waka-database-card/WakaDatabaseCard.stories.tsx +306 -0
- package/src/components/waka-date-range-picker/WakaDateRangePicker.stories.tsx +339 -0
- package/src/components/waka-datetime-picker/WakaDateTimePicker.stories.tsx +317 -0
- package/src/components/waka-deployment-lane/WakaDeploymentLane.stories.tsx +292 -0
- package/src/components/waka-dock/WakaDock.stories.tsx +332 -0
- package/src/components/waka-drawer/WakaDrawer.stories.tsx +437 -0
- package/src/components/waka-env-var-editor/WakaEnvVarEditor.stories.tsx +263 -0
- package/src/components/waka-error-shake/WakaErrorShake.stories.tsx +410 -0
- package/src/components/waka-file-upload/WakaFileUpload.stories.tsx +239 -0
- package/src/components/waka-flow-diagram/WakaFlowDiagram.stories.tsx +365 -0
- package/src/components/waka-funnel-chart/WakaFunnelChart.stories.tsx +281 -0
- package/src/components/waka-glow-card/WakaGlowCard.stories.tsx +274 -0
- package/src/components/waka-haptic-button/WakaHapticButton.stories.tsx +349 -0
- package/src/components/waka-health-pulse/WakaHealthPulse.stories.tsx +293 -0
- package/src/components/waka-heatmap/WakaHeatmap.stories.tsx +376 -0
- package/src/components/waka-image/WakaImage.stories.tsx +255 -0
- package/src/components/waka-incident-timeline/WakaIncidentTimeline.stories.tsx +300 -0
- package/src/components/waka-kanban/WakaKanban.stories.tsx +399 -0
- package/src/components/waka-kubernetes-overview/WakaKubernetesOverview.stories.tsx +281 -0
- package/src/components/waka-leaderboard/WakaLeaderboard.stories.tsx +300 -0
- package/src/components/waka-level-progress/WakaLevelProgress.stories.tsx +313 -0
- package/src/components/waka-loading-orbit/WakaLoadingOrbit.stories.tsx +413 -0
- package/src/components/waka-log-viewer/WakaLogViewer.stories.tsx +312 -0
- package/src/components/waka-loot-box/WakaLootBox.stories.tsx +374 -0
- package/src/components/waka-metric-sparkline/WakaMetricSparkline.stories.tsx +312 -0
- package/src/components/waka-migration-list/WakaMigrationList.stories.tsx +289 -0
- package/src/components/waka-modal/WakaModal.stories.tsx +434 -0
- package/src/components/waka-morph-button/WakaMorphButton.stories.tsx +405 -0
- package/src/components/waka-network-topology/WakaNetworkTopology.stories.tsx +364 -0
- package/src/components/waka-notifications/WakaNotifications.stories.tsx +290 -0
- package/src/components/waka-number-input/WakaNumberInput.stories.tsx +282 -0
- package/src/components/waka-pagination/WakaPagination.stories.tsx +328 -0
- package/src/components/waka-password-strength/WakaPasswordStrength.stories.tsx +318 -0
- package/src/components/waka-pipeline-view/WakaPipelineView.stories.tsx +386 -0
- package/src/components/waka-player-card/WakaPlayerCard.stories.tsx +333 -0
- package/src/components/waka-pod-card/WakaPodCard.stories.tsx +435 -0
- package/src/components/waka-qrcode/WakaQRCode.stories.tsx +232 -0
- package/src/components/waka-query-explain/WakaQueryExplain.stories.tsx +407 -0
- package/src/components/waka-quest-card/WakaQuestCard.stories.tsx +394 -0
- package/src/components/waka-quota-bar/WakaQuotaBar.stories.tsx +435 -0
- package/src/components/waka-radar-score/WakaRadarScore.stories.tsx +372 -0
- package/src/components/waka-resource-gauge/WakaResourceGauge.stories.tsx +366 -0
- package/src/components/waka-rich-text-editor/WakaRichTextEditor.stories.tsx +238 -0
- package/src/components/waka-sankey-diagram/WakaSankeyDiagram.stories.tsx +389 -0
- package/src/components/waka-scratch-card/WakaScratchCard.stories.tsx +388 -0
- package/src/components/waka-secret-card/WakaSecretCard.stories.tsx +314 -0
- package/src/components/waka-segmented-control/WakaSegmentedControl.stories.tsx +309 -0
- package/src/components/waka-server-rack/WakaServerRack.stories.tsx +382 -0
- package/src/components/waka-service-graph/WakaServiceGraph.stories.tsx +262 -0
- package/src/components/waka-skeleton-wave/WakaSkeletonWave.stories.tsx +321 -0
- package/src/components/waka-skill-tree/WakaSkillTree.stories.tsx +308 -0
- package/src/components/waka-spin-wheel/WakaSpinWheel.stories.tsx +368 -0
- package/src/components/waka-spinner/WakaSpinner.stories.tsx +156 -0
- package/src/components/waka-stat/WakaStat.stories.tsx +334 -0
- package/src/components/waka-status-matrix/WakaStatusMatrix.stories.tsx +331 -0
- package/src/components/waka-stepper/WakaStepper.stories.tsx +468 -0
- package/src/components/waka-streak-counter/WakaStreakCounter.stories.tsx +235 -0
- package/src/components/waka-success-explosion/WakaSuccessExplosion.stories.tsx +389 -0
- package/src/components/waka-tabs-morph/WakaTabsMorph.stories.tsx +471 -0
- package/src/components/waka-terminal-output/WakaTerminalOutput.stories.tsx +351 -0
- package/src/components/waka-test-report/WakaTestReport.stories.tsx +322 -0
- package/src/components/waka-tilt-card/WakaTiltCard.stories.tsx +300 -0
- package/src/components/waka-time-picker/WakaTimePicker.stories.tsx +227 -0
- package/src/components/waka-timeline/WakaTimeline.stories.tsx +383 -0
- package/src/components/waka-tournament-bracket/WakaTournamentBracket.stories.tsx +375 -0
- package/src/components/waka-trace-viewer/WakaTraceViewer.stories.tsx +445 -0
- package/src/components/waka-tree/WakaTree.stories.tsx +359 -0
- package/src/components/waka-treemap-chart/WakaTreemapChart.stories.tsx +378 -0
- package/src/components/waka-typewriter/WakaTypewriter.stories.tsx +366 -0
- package/src/components/waka-versus-card/WakaVersusCard.stories.tsx +530 -0
- package/src/components/waka-video/WakaVideo.stories.tsx +203 -0
- package/src/components/waka-virtual-list/WakaVirtualList.stories.tsx +273 -0
- package/src/components/waka-xp-bar/WakaXPBar.stories.tsx +305 -0
|
@@ -0,0 +1,375 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/react'
|
|
2
|
+
import { WakaTournamentBracket, useTournamentBracket } from './index'
|
|
3
|
+
import type { BracketRound, Match, Participant } from './index'
|
|
4
|
+
import * as React from 'react'
|
|
5
|
+
|
|
6
|
+
const participants: Participant[] = [
|
|
7
|
+
{ id: '1', name: 'DragonSlayer', avatar: 'https://i.pravatar.cc/100?img=1', seed: 1 },
|
|
8
|
+
{ id: '2', name: 'NightHawk', avatar: 'https://i.pravatar.cc/100?img=2', seed: 2 },
|
|
9
|
+
{ id: '3', name: 'ShadowMage', avatar: 'https://i.pravatar.cc/100?img=3', seed: 3 },
|
|
10
|
+
{ id: '4', name: 'BlazeFury', avatar: 'https://i.pravatar.cc/100?img=4', seed: 4 },
|
|
11
|
+
{ id: '5', name: 'IceStorm', avatar: 'https://i.pravatar.cc/100?img=5', seed: 5 },
|
|
12
|
+
{ id: '6', name: 'ThunderBolt', avatar: 'https://i.pravatar.cc/100?img=6', seed: 6 },
|
|
13
|
+
{ id: '7', name: 'PhoenixRise', avatar: 'https://i.pravatar.cc/100?img=7', seed: 7 },
|
|
14
|
+
{ id: '8', name: 'VoidWalker', avatar: 'https://i.pravatar.cc/100?img=8', seed: 8 },
|
|
15
|
+
]
|
|
16
|
+
|
|
17
|
+
const completedRounds: BracketRound[] = [
|
|
18
|
+
{
|
|
19
|
+
name: 'Quarter Finals',
|
|
20
|
+
matches: [
|
|
21
|
+
{ id: 'qf1', round: 0, position: 0, participant1: participants[0], participant2: participants[7], score1: 3, score2: 1, status: 'completed', winnerId: '1' },
|
|
22
|
+
{ id: 'qf2', round: 0, position: 1, participant1: participants[3], participant2: participants[4], score1: 2, score2: 3, status: 'completed', winnerId: '5' },
|
|
23
|
+
{ id: 'qf3', round: 0, position: 2, participant1: participants[2], participant2: participants[5], score1: 3, score2: 0, status: 'completed', winnerId: '3' },
|
|
24
|
+
{ id: 'qf4', round: 0, position: 3, participant1: participants[1], participant2: participants[6], score1: 3, score2: 2, status: 'completed', winnerId: '2' },
|
|
25
|
+
],
|
|
26
|
+
},
|
|
27
|
+
{
|
|
28
|
+
name: 'Semi Finals',
|
|
29
|
+
matches: [
|
|
30
|
+
{ id: 'sf1', round: 1, position: 0, participant1: participants[0], participant2: participants[4], score1: 3, score2: 2, status: 'completed', winnerId: '1' },
|
|
31
|
+
{ id: 'sf2', round: 1, position: 1, participant1: participants[2], participant2: participants[1], score1: 1, score2: 3, status: 'completed', winnerId: '2' },
|
|
32
|
+
],
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
name: 'Finals',
|
|
36
|
+
matches: [
|
|
37
|
+
{ id: 'f1', round: 2, position: 0, participant1: participants[0], participant2: participants[1], score1: 3, score2: 2, status: 'completed', winnerId: '1' },
|
|
38
|
+
],
|
|
39
|
+
},
|
|
40
|
+
]
|
|
41
|
+
|
|
42
|
+
const liveRounds: BracketRound[] = [
|
|
43
|
+
{
|
|
44
|
+
name: 'Quarter Finals',
|
|
45
|
+
matches: [
|
|
46
|
+
{ id: 'qf1', round: 0, position: 0, participant1: participants[0], participant2: participants[7], score1: 3, score2: 1, status: 'completed', winnerId: '1' },
|
|
47
|
+
{ id: 'qf2', round: 0, position: 1, participant1: participants[3], participant2: participants[4], score1: 2, score2: 3, status: 'completed', winnerId: '5' },
|
|
48
|
+
{ id: 'qf3', round: 0, position: 2, participant1: participants[2], participant2: participants[5], score1: 2, score2: 1, status: 'in_progress' },
|
|
49
|
+
{ id: 'qf4', round: 0, position: 3, participant1: participants[1], participant2: participants[6], status: 'pending' },
|
|
50
|
+
],
|
|
51
|
+
},
|
|
52
|
+
{
|
|
53
|
+
name: 'Semi Finals',
|
|
54
|
+
matches: [
|
|
55
|
+
{ id: 'sf1', round: 1, position: 0, participant1: participants[0], participant2: participants[4], status: 'pending' },
|
|
56
|
+
{ id: 'sf2', round: 1, position: 1, status: 'pending' },
|
|
57
|
+
],
|
|
58
|
+
},
|
|
59
|
+
{
|
|
60
|
+
name: 'Finals',
|
|
61
|
+
matches: [
|
|
62
|
+
{ id: 'f1', round: 2, position: 0, status: 'pending' },
|
|
63
|
+
],
|
|
64
|
+
},
|
|
65
|
+
]
|
|
66
|
+
|
|
67
|
+
const meta: Meta<typeof WakaTournamentBracket> = {
|
|
68
|
+
title: 'Components/Gamification/WakaTournamentBracket',
|
|
69
|
+
component: WakaTournamentBracket,
|
|
70
|
+
parameters: {
|
|
71
|
+
layout: 'fullscreen',
|
|
72
|
+
docs: {
|
|
73
|
+
description: {
|
|
74
|
+
component: 'A tournament bracket visualization with zoom/pan, winner path highlighting, match details popover, and celebration effects.',
|
|
75
|
+
},
|
|
76
|
+
},
|
|
77
|
+
},
|
|
78
|
+
tags: ['autodocs'],
|
|
79
|
+
argTypes: {
|
|
80
|
+
size: {
|
|
81
|
+
control: 'select',
|
|
82
|
+
options: ['sm', 'default', 'lg'],
|
|
83
|
+
description: 'Match card size',
|
|
84
|
+
},
|
|
85
|
+
enableZoomPan: {
|
|
86
|
+
control: 'boolean',
|
|
87
|
+
description: 'Enable zoom and pan controls',
|
|
88
|
+
},
|
|
89
|
+
showTimes: {
|
|
90
|
+
control: 'boolean',
|
|
91
|
+
description: 'Show scheduled match times',
|
|
92
|
+
},
|
|
93
|
+
animated: {
|
|
94
|
+
control: 'boolean',
|
|
95
|
+
description: 'Enable animations',
|
|
96
|
+
},
|
|
97
|
+
},
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
export default meta
|
|
101
|
+
type Story = StoryObj<typeof WakaTournamentBracket>
|
|
102
|
+
|
|
103
|
+
export const Default: Story = {
|
|
104
|
+
args: {
|
|
105
|
+
title: 'Summer Championship 2024',
|
|
106
|
+
rounds: completedRounds,
|
|
107
|
+
},
|
|
108
|
+
render: (args) => (
|
|
109
|
+
<div className="p-6">
|
|
110
|
+
<WakaTournamentBracket {...args} />
|
|
111
|
+
</div>
|
|
112
|
+
),
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
export const LiveTournament: Story = {
|
|
116
|
+
render: () => (
|
|
117
|
+
<div className="p-6">
|
|
118
|
+
<WakaTournamentBracket
|
|
119
|
+
title="Live Tournament"
|
|
120
|
+
rounds={liveRounds}
|
|
121
|
+
/>
|
|
122
|
+
</div>
|
|
123
|
+
),
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
export const Sizes: Story = {
|
|
127
|
+
render: () => (
|
|
128
|
+
<div className="space-y-8 p-6">
|
|
129
|
+
<div>
|
|
130
|
+
<p className="text-sm text-muted-foreground mb-2">Small</p>
|
|
131
|
+
<WakaTournamentBracket
|
|
132
|
+
title="Small Bracket"
|
|
133
|
+
rounds={completedRounds}
|
|
134
|
+
size="sm"
|
|
135
|
+
/>
|
|
136
|
+
</div>
|
|
137
|
+
<div>
|
|
138
|
+
<p className="text-sm text-muted-foreground mb-2">Default</p>
|
|
139
|
+
<WakaTournamentBracket
|
|
140
|
+
title="Default Bracket"
|
|
141
|
+
rounds={completedRounds}
|
|
142
|
+
size="default"
|
|
143
|
+
/>
|
|
144
|
+
</div>
|
|
145
|
+
<div>
|
|
146
|
+
<p className="text-sm text-muted-foreground mb-2">Large</p>
|
|
147
|
+
<WakaTournamentBracket
|
|
148
|
+
title="Large Bracket"
|
|
149
|
+
rounds={completedRounds}
|
|
150
|
+
size="lg"
|
|
151
|
+
/>
|
|
152
|
+
</div>
|
|
153
|
+
</div>
|
|
154
|
+
),
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
export const WithScheduledTimes: Story = {
|
|
158
|
+
render: () => {
|
|
159
|
+
const scheduledRounds: BracketRound[] = liveRounds.map(round => ({
|
|
160
|
+
...round,
|
|
161
|
+
matches: round.matches.map(match => ({
|
|
162
|
+
...match,
|
|
163
|
+
scheduledAt: new Date(Date.now() + Math.random() * 24 * 60 * 60 * 1000),
|
|
164
|
+
})),
|
|
165
|
+
}))
|
|
166
|
+
|
|
167
|
+
return (
|
|
168
|
+
<div className="p-6">
|
|
169
|
+
<WakaTournamentBracket
|
|
170
|
+
title="Scheduled Tournament"
|
|
171
|
+
rounds={scheduledRounds}
|
|
172
|
+
showTimes
|
|
173
|
+
/>
|
|
174
|
+
</div>
|
|
175
|
+
)
|
|
176
|
+
},
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
export const Interactive: Story = {
|
|
180
|
+
render: () => {
|
|
181
|
+
const [selectedMatch, setSelectedMatch] = React.useState<Match | null>(null)
|
|
182
|
+
|
|
183
|
+
return (
|
|
184
|
+
<div className="p-6">
|
|
185
|
+
<WakaTournamentBracket
|
|
186
|
+
title="Interactive Tournament"
|
|
187
|
+
rounds={liveRounds}
|
|
188
|
+
onMatchClick={(match) => setSelectedMatch(match)}
|
|
189
|
+
onMatchHover={(match) => console.log('Hovered:', match?.id)}
|
|
190
|
+
/>
|
|
191
|
+
|
|
192
|
+
{selectedMatch && (
|
|
193
|
+
<div className="fixed bottom-4 right-4 p-4 rounded-lg border bg-card shadow-lg max-w-xs">
|
|
194
|
+
<h4 className="font-semibold mb-2">Selected Match</h4>
|
|
195
|
+
<div className="text-sm space-y-1">
|
|
196
|
+
<div>ID: {selectedMatch.id}</div>
|
|
197
|
+
<div>Status: {selectedMatch.status}</div>
|
|
198
|
+
<div>
|
|
199
|
+
{selectedMatch.participant1?.name || 'TBD'} vs {selectedMatch.participant2?.name || 'TBD'}
|
|
200
|
+
</div>
|
|
201
|
+
{selectedMatch.status === 'completed' && (
|
|
202
|
+
<div className="font-medium text-green-500">
|
|
203
|
+
Winner: {selectedMatch.winnerId === selectedMatch.participant1?.id
|
|
204
|
+
? selectedMatch.participant1?.name
|
|
205
|
+
: selectedMatch.participant2?.name}
|
|
206
|
+
</div>
|
|
207
|
+
)}
|
|
208
|
+
</div>
|
|
209
|
+
</div>
|
|
210
|
+
)}
|
|
211
|
+
</div>
|
|
212
|
+
)
|
|
213
|
+
},
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
export const WithHook: Story = {
|
|
217
|
+
render: () => {
|
|
218
|
+
const {
|
|
219
|
+
rounds,
|
|
220
|
+
startMatch,
|
|
221
|
+
completeMatch,
|
|
222
|
+
currentMatch,
|
|
223
|
+
winner,
|
|
224
|
+
resetBracket,
|
|
225
|
+
} = useTournamentBracket({
|
|
226
|
+
participants: participants.slice(0, 4),
|
|
227
|
+
})
|
|
228
|
+
|
|
229
|
+
return (
|
|
230
|
+
<div className="p-6">
|
|
231
|
+
<WakaTournamentBracket
|
|
232
|
+
title="Generated Bracket"
|
|
233
|
+
rounds={rounds}
|
|
234
|
+
/>
|
|
235
|
+
|
|
236
|
+
<div className="fixed bottom-4 left-4 p-4 rounded-lg border bg-card shadow-lg">
|
|
237
|
+
<h4 className="font-semibold mb-2">Controls</h4>
|
|
238
|
+
{currentMatch && (
|
|
239
|
+
<div className="text-sm mb-3">
|
|
240
|
+
<div>Current Match: {currentMatch.id}</div>
|
|
241
|
+
<div>
|
|
242
|
+
{currentMatch.participant1?.name} vs {currentMatch.participant2?.name}
|
|
243
|
+
</div>
|
|
244
|
+
</div>
|
|
245
|
+
)}
|
|
246
|
+
|
|
247
|
+
<div className="flex flex-wrap gap-2">
|
|
248
|
+
{currentMatch && currentMatch.status === 'pending' && (
|
|
249
|
+
<button
|
|
250
|
+
onClick={() => startMatch(currentMatch.id)}
|
|
251
|
+
className="px-3 py-1.5 text-xs rounded bg-primary text-primary-foreground"
|
|
252
|
+
>
|
|
253
|
+
Start Match
|
|
254
|
+
</button>
|
|
255
|
+
)}
|
|
256
|
+
{currentMatch && currentMatch.status === 'in_progress' && (
|
|
257
|
+
<>
|
|
258
|
+
<button
|
|
259
|
+
onClick={() => completeMatch(currentMatch.id, 3, 1)}
|
|
260
|
+
className="px-3 py-1.5 text-xs rounded bg-green-500 text-white"
|
|
261
|
+
>
|
|
262
|
+
P1 Wins (3-1)
|
|
263
|
+
</button>
|
|
264
|
+
<button
|
|
265
|
+
onClick={() => completeMatch(currentMatch.id, 1, 3)}
|
|
266
|
+
className="px-3 py-1.5 text-xs rounded bg-blue-500 text-white"
|
|
267
|
+
>
|
|
268
|
+
P2 Wins (1-3)
|
|
269
|
+
</button>
|
|
270
|
+
</>
|
|
271
|
+
)}
|
|
272
|
+
<button
|
|
273
|
+
onClick={() => resetBracket()}
|
|
274
|
+
className="px-3 py-1.5 text-xs rounded border hover:bg-muted"
|
|
275
|
+
>
|
|
276
|
+
Reset
|
|
277
|
+
</button>
|
|
278
|
+
</div>
|
|
279
|
+
|
|
280
|
+
{winner && (
|
|
281
|
+
<div className="mt-3 pt-3 border-t text-center">
|
|
282
|
+
<span className="text-amber-500 font-bold">
|
|
283
|
+
Champion: {winner.name}
|
|
284
|
+
</span>
|
|
285
|
+
</div>
|
|
286
|
+
)}
|
|
287
|
+
</div>
|
|
288
|
+
</div>
|
|
289
|
+
)
|
|
290
|
+
},
|
|
291
|
+
}
|
|
292
|
+
|
|
293
|
+
export const SixteenTeams: Story = {
|
|
294
|
+
render: () => {
|
|
295
|
+
const allParticipants: Participant[] = Array.from({ length: 16 }, (_, i) => ({
|
|
296
|
+
id: `p${i + 1}`,
|
|
297
|
+
name: `Team ${i + 1}`,
|
|
298
|
+
seed: i + 1,
|
|
299
|
+
}))
|
|
300
|
+
|
|
301
|
+
const { rounds } = useTournamentBracket({
|
|
302
|
+
participants: allParticipants,
|
|
303
|
+
})
|
|
304
|
+
|
|
305
|
+
// Simulate some completed matches
|
|
306
|
+
const simulatedRounds = rounds.map((round, rIdx) => ({
|
|
307
|
+
...round,
|
|
308
|
+
matches: round.matches.map((match, mIdx) => {
|
|
309
|
+
if (rIdx === 0 && mIdx < 4) {
|
|
310
|
+
return {
|
|
311
|
+
...match,
|
|
312
|
+
score1: Math.floor(Math.random() * 3) + 1,
|
|
313
|
+
score2: Math.floor(Math.random() * 2),
|
|
314
|
+
status: 'completed' as const,
|
|
315
|
+
winnerId: match.participant1?.id,
|
|
316
|
+
}
|
|
317
|
+
}
|
|
318
|
+
return match
|
|
319
|
+
}),
|
|
320
|
+
}))
|
|
321
|
+
|
|
322
|
+
return (
|
|
323
|
+
<div className="p-6">
|
|
324
|
+
<WakaTournamentBracket
|
|
325
|
+
title="16-Team Championship"
|
|
326
|
+
rounds={simulatedRounds}
|
|
327
|
+
size="sm"
|
|
328
|
+
/>
|
|
329
|
+
</div>
|
|
330
|
+
)
|
|
331
|
+
},
|
|
332
|
+
}
|
|
333
|
+
|
|
334
|
+
export const NoZoomPan: Story = {
|
|
335
|
+
render: () => (
|
|
336
|
+
<div className="p-6">
|
|
337
|
+
<WakaTournamentBracket
|
|
338
|
+
title="Static Bracket"
|
|
339
|
+
rounds={completedRounds}
|
|
340
|
+
enableZoomPan={false}
|
|
341
|
+
/>
|
|
342
|
+
</div>
|
|
343
|
+
),
|
|
344
|
+
}
|
|
345
|
+
|
|
346
|
+
export const NoAnimation: Story = {
|
|
347
|
+
render: () => (
|
|
348
|
+
<div className="p-6">
|
|
349
|
+
<WakaTournamentBracket
|
|
350
|
+
title="No Animation"
|
|
351
|
+
rounds={completedRounds}
|
|
352
|
+
animated={false}
|
|
353
|
+
/>
|
|
354
|
+
</div>
|
|
355
|
+
),
|
|
356
|
+
}
|
|
357
|
+
|
|
358
|
+
export const EsportsStyled: Story = {
|
|
359
|
+
render: () => (
|
|
360
|
+
<div className="min-h-screen bg-gradient-to-br from-slate-900 via-purple-900 to-slate-900 p-6">
|
|
361
|
+
<div className="max-w-6xl mx-auto">
|
|
362
|
+
<div className="text-center mb-8">
|
|
363
|
+
<h1 className="text-3xl font-bold text-white mb-2">World Championship 2024</h1>
|
|
364
|
+
<p className="text-purple-300">Grand Finals • $100,000 Prize Pool</p>
|
|
365
|
+
</div>
|
|
366
|
+
|
|
367
|
+
<WakaTournamentBracket
|
|
368
|
+
title=""
|
|
369
|
+
rounds={completedRounds}
|
|
370
|
+
size="lg"
|
|
371
|
+
/>
|
|
372
|
+
</div>
|
|
373
|
+
</div>
|
|
374
|
+
),
|
|
375
|
+
}
|