@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.
Files changed (194) hide show
  1. package/dist/blocks/dashboard/index.d.ts +4 -1
  2. package/dist/blocks/empty-states/index.d.ts +4 -1
  3. package/dist/blocks/error-pages/index.d.ts +4 -1
  4. package/dist/blocks/index.d.ts +1 -1
  5. package/dist/blocks/landing/index.d.ts +4 -1
  6. package/dist/blocks/pricing/index.d.ts +5 -1
  7. package/dist/blocks/sidebar/index.d.ts +5 -1
  8. package/dist/index.cjs.js +130 -130
  9. package/dist/index.d.ts +1 -0
  10. package/dist/index.es.js +7905 -7856
  11. package/dist/stories/Button.d.ts +14 -0
  12. package/dist/stories/Button.stories.d.ts +8 -0
  13. package/dist/stories/Header.d.ts +11 -0
  14. package/dist/stories/Header.stories.d.ts +6 -0
  15. package/dist/stories/Page.d.ts +2 -0
  16. package/dist/stories/Page.stories.d.ts +6 -0
  17. package/dist/types/index.d.ts +1 -0
  18. package/dist/types/link.d.ts +23 -0
  19. package/package.json +11 -3
  20. package/src/blocks/activity-timeline/ActivityTimeline.stories.tsx +460 -0
  21. package/src/blocks/apm-overview/APMOverview.stories.tsx +435 -0
  22. package/src/blocks/auth-2fa/Auth2FA.stories.tsx +308 -0
  23. package/src/blocks/calendar-view/CalendarView.stories.tsx +398 -0
  24. package/src/blocks/chat/Chat.stories.tsx +466 -0
  25. package/src/blocks/chat-interface/ChatInterface.stories.tsx +412 -0
  26. package/src/blocks/checkout-flow/CheckoutFlow.stories.tsx +408 -0
  27. package/src/blocks/cicd-builder/CICDBuilder.stories.tsx +499 -0
  28. package/src/blocks/cloud-cost-dashboard/CloudCostDashboard.stories.tsx +356 -0
  29. package/src/blocks/container-orchestrator/ContainerOrchestrator.stories.tsx +461 -0
  30. package/src/blocks/dashboard/Dashboard.stories.tsx +559 -0
  31. package/src/blocks/dashboard/index.tsx +68 -27
  32. package/src/blocks/dashboard-kpi/DashboardKPI.stories.tsx +422 -0
  33. package/src/blocks/database-admin/DatabaseAdmin.stories.tsx +393 -0
  34. package/src/blocks/deployment-dashboard/DeploymentDashboard.stories.tsx +457 -0
  35. package/src/blocks/empty-states/EmptyStates.stories.tsx +467 -0
  36. package/src/blocks/empty-states/index.tsx +26 -8
  37. package/src/blocks/error-pages/ErrorPages.stories.tsx +401 -0
  38. package/src/blocks/error-pages/index.tsx +26 -8
  39. package/src/blocks/faq/FAQ.stories.tsx +416 -0
  40. package/src/blocks/file-manager/FileManager.stories.tsx +413 -0
  41. package/src/blocks/footer/Footer.stories.tsx +328 -0
  42. package/src/blocks/gitops-sync-status/GitOpsSyncStatus.stories.tsx +529 -0
  43. package/src/blocks/header/WakaHeader.stories.tsx +455 -0
  44. package/src/blocks/headtab/Headtab.stories.tsx +369 -0
  45. package/src/blocks/i18n-editor/I18nEditor.stories.tsx +451 -0
  46. package/src/blocks/incident-manager/IncidentManager.stories.tsx +464 -0
  47. package/src/blocks/index.ts +1 -1
  48. package/src/blocks/infrastructure-map/InfrastructureMap.stories.tsx +533 -0
  49. package/src/blocks/kanban-board/KanbanBoard.stories.tsx +494 -0
  50. package/src/blocks/landing/WakaLanding.stories.tsx +449 -0
  51. package/src/blocks/landing/index.tsx +125 -66
  52. package/src/blocks/language-selector/LanguageSelector.stories.tsx +345 -0
  53. package/src/blocks/layout/Layout.stories.tsx +373 -0
  54. package/src/blocks/login/Login.stories.tsx +443 -0
  55. package/src/blocks/on-call-schedule/OnCallSchedule.stories.tsx +381 -0
  56. package/src/blocks/player-profile/PlayerProfile.stories.tsx +316 -0
  57. package/src/blocks/pricing/WakaPricing.stories.tsx +530 -0
  58. package/src/blocks/pricing/index.tsx +38 -4
  59. package/src/blocks/profile/Profile.stories.tsx +371 -0
  60. package/src/blocks/release-notes/ReleaseNotes.stories.tsx +431 -0
  61. package/src/blocks/settings/Settings.stories.tsx +520 -0
  62. package/src/blocks/sidebar/WakaSidebar.stories.tsx +513 -0
  63. package/src/blocks/sidebar/index.tsx +49 -20
  64. package/src/blocks/theme-creator-block/ThemeCreatorBlock.stories.tsx +370 -0
  65. package/src/blocks/user-management/UserManagement.stories.tsx +411 -0
  66. package/src/blocks/wizard/Wizard.stories.tsx +683 -0
  67. package/src/components/accordion/Accordion.stories.tsx +93 -0
  68. package/src/components/alert/Alert.stories.tsx +95 -0
  69. package/src/components/alert-dialog/AlertDialog.stories.tsx +126 -0
  70. package/src/components/aspect-ratio/AspectRatio.stories.tsx +118 -0
  71. package/src/components/avatar/Avatar.stories.tsx +104 -0
  72. package/src/components/button/Button.stories.tsx +12 -1
  73. package/src/components/calendar/Calendar.stories.tsx +102 -0
  74. package/src/components/card/Card.stories.tsx +125 -0
  75. package/src/components/checkbox/Checkbox.stories.tsx +100 -0
  76. package/src/components/code/Code.stories.tsx +402 -0
  77. package/src/components/collapsible/Collapsible.stories.tsx +123 -0
  78. package/src/components/command/Command.stories.tsx +207 -0
  79. package/src/components/context-menu/ContextMenu.stories.tsx +220 -0
  80. package/src/components/dialog/Dialog.stories.tsx +157 -0
  81. package/src/components/dropdown-menu/DropdownMenu.stories.tsx +225 -0
  82. package/src/components/form/Form.stories.tsx +413 -0
  83. package/src/components/hover-card/HoverCard.stories.tsx +148 -0
  84. package/src/components/input-otp/InputOTP.stories.tsx +255 -0
  85. package/src/components/label/Label.stories.tsx +68 -0
  86. package/src/components/menubar/Menubar.stories.tsx +278 -0
  87. package/src/components/navigation-menu/NavigationMenu.stories.tsx +202 -0
  88. package/src/components/popover/Popover.stories.tsx +199 -0
  89. package/src/components/progress/Progress.stories.tsx +104 -0
  90. package/src/components/radio-group/RadioGroup.stories.tsx +138 -0
  91. package/src/components/scroll-area/ScrollArea.stories.tsx +153 -0
  92. package/src/components/select/Select.stories.tsx +146 -0
  93. package/src/components/separator/Separator.stories.tsx +117 -0
  94. package/src/components/sheet/Sheet.stories.tsx +195 -0
  95. package/src/components/skeleton/Skeleton.stories.tsx +114 -0
  96. package/src/components/slider/Slider.stories.tsx +157 -0
  97. package/src/components/switch/Switch.stories.tsx +114 -0
  98. package/src/components/table/Table.stories.tsx +153 -0
  99. package/src/components/tabs/Tabs.stories.tsx +155 -0
  100. package/src/components/textarea/Textarea.stories.tsx +116 -0
  101. package/src/components/toast/Toast.stories.tsx +160 -0
  102. package/src/components/toggle/Toggle.stories.tsx +125 -0
  103. package/src/components/tooltip/Tooltip.stories.tsx +133 -0
  104. package/src/components/typography/Typography.stories.tsx +207 -0
  105. package/src/components/waka-3d-pie-chart/Waka3DPieChart.stories.tsx +308 -0
  106. package/src/components/waka-achievement-unlock/WakaAchievementUnlock.stories.tsx +353 -0
  107. package/src/components/waka-artifact-list/WakaArtifactList.stories.tsx +258 -0
  108. package/src/components/waka-autocomplete/WakaAutocomplete.stories.tsx +224 -0
  109. package/src/components/waka-badge-showcase/WakaBadgeShowcase.stories.tsx +269 -0
  110. package/src/components/waka-barcode/WakaBarcode.stories.tsx +227 -0
  111. package/src/components/waka-bottom-sheet/WakaBottomSheet.stories.tsx +408 -0
  112. package/src/components/waka-breadcrumb/WakaBreadcrumb.stories.tsx +237 -0
  113. package/src/components/waka-build-matrix/WakaBuildMatrix.stories.tsx +328 -0
  114. package/src/components/waka-carousel/WakaCarousel.stories.tsx +296 -0
  115. package/src/components/waka-charts/WakaCharts.stories.tsx +519 -0
  116. package/src/components/waka-color-picker/WakaColorPicker.stories.tsx +200 -0
  117. package/src/components/waka-combobox/WakaCombobox.stories.tsx +250 -0
  118. package/src/components/waka-container-list/WakaContainerList.stories.tsx +315 -0
  119. package/src/components/waka-contribution-graph/WakaContributionGraph.stories.tsx +354 -0
  120. package/src/components/waka-cost-breakdown/WakaCostBreakdown.stories.tsx +348 -0
  121. package/src/components/waka-daily-reward/WakaDailyReward.stories.tsx +365 -0
  122. package/src/components/waka-database-card/WakaDatabaseCard.stories.tsx +306 -0
  123. package/src/components/waka-date-range-picker/WakaDateRangePicker.stories.tsx +339 -0
  124. package/src/components/waka-datetime-picker/WakaDateTimePicker.stories.tsx +317 -0
  125. package/src/components/waka-deployment-lane/WakaDeploymentLane.stories.tsx +292 -0
  126. package/src/components/waka-dock/WakaDock.stories.tsx +332 -0
  127. package/src/components/waka-drawer/WakaDrawer.stories.tsx +437 -0
  128. package/src/components/waka-env-var-editor/WakaEnvVarEditor.stories.tsx +263 -0
  129. package/src/components/waka-error-shake/WakaErrorShake.stories.tsx +410 -0
  130. package/src/components/waka-file-upload/WakaFileUpload.stories.tsx +239 -0
  131. package/src/components/waka-flow-diagram/WakaFlowDiagram.stories.tsx +365 -0
  132. package/src/components/waka-funnel-chart/WakaFunnelChart.stories.tsx +281 -0
  133. package/src/components/waka-glow-card/WakaGlowCard.stories.tsx +274 -0
  134. package/src/components/waka-haptic-button/WakaHapticButton.stories.tsx +349 -0
  135. package/src/components/waka-health-pulse/WakaHealthPulse.stories.tsx +293 -0
  136. package/src/components/waka-heatmap/WakaHeatmap.stories.tsx +376 -0
  137. package/src/components/waka-image/WakaImage.stories.tsx +255 -0
  138. package/src/components/waka-incident-timeline/WakaIncidentTimeline.stories.tsx +300 -0
  139. package/src/components/waka-kanban/WakaKanban.stories.tsx +399 -0
  140. package/src/components/waka-kubernetes-overview/WakaKubernetesOverview.stories.tsx +281 -0
  141. package/src/components/waka-leaderboard/WakaLeaderboard.stories.tsx +300 -0
  142. package/src/components/waka-level-progress/WakaLevelProgress.stories.tsx +313 -0
  143. package/src/components/waka-loading-orbit/WakaLoadingOrbit.stories.tsx +413 -0
  144. package/src/components/waka-log-viewer/WakaLogViewer.stories.tsx +312 -0
  145. package/src/components/waka-loot-box/WakaLootBox.stories.tsx +374 -0
  146. package/src/components/waka-metric-sparkline/WakaMetricSparkline.stories.tsx +312 -0
  147. package/src/components/waka-migration-list/WakaMigrationList.stories.tsx +289 -0
  148. package/src/components/waka-modal/WakaModal.stories.tsx +434 -0
  149. package/src/components/waka-morph-button/WakaMorphButton.stories.tsx +405 -0
  150. package/src/components/waka-network-topology/WakaNetworkTopology.stories.tsx +364 -0
  151. package/src/components/waka-notifications/WakaNotifications.stories.tsx +290 -0
  152. package/src/components/waka-number-input/WakaNumberInput.stories.tsx +282 -0
  153. package/src/components/waka-pagination/WakaPagination.stories.tsx +328 -0
  154. package/src/components/waka-password-strength/WakaPasswordStrength.stories.tsx +318 -0
  155. package/src/components/waka-pipeline-view/WakaPipelineView.stories.tsx +386 -0
  156. package/src/components/waka-player-card/WakaPlayerCard.stories.tsx +333 -0
  157. package/src/components/waka-pod-card/WakaPodCard.stories.tsx +435 -0
  158. package/src/components/waka-qrcode/WakaQRCode.stories.tsx +232 -0
  159. package/src/components/waka-query-explain/WakaQueryExplain.stories.tsx +407 -0
  160. package/src/components/waka-quest-card/WakaQuestCard.stories.tsx +394 -0
  161. package/src/components/waka-quota-bar/WakaQuotaBar.stories.tsx +435 -0
  162. package/src/components/waka-radar-score/WakaRadarScore.stories.tsx +372 -0
  163. package/src/components/waka-resource-gauge/WakaResourceGauge.stories.tsx +366 -0
  164. package/src/components/waka-rich-text-editor/WakaRichTextEditor.stories.tsx +238 -0
  165. package/src/components/waka-sankey-diagram/WakaSankeyDiagram.stories.tsx +389 -0
  166. package/src/components/waka-scratch-card/WakaScratchCard.stories.tsx +388 -0
  167. package/src/components/waka-secret-card/WakaSecretCard.stories.tsx +314 -0
  168. package/src/components/waka-segmented-control/WakaSegmentedControl.stories.tsx +309 -0
  169. package/src/components/waka-server-rack/WakaServerRack.stories.tsx +382 -0
  170. package/src/components/waka-service-graph/WakaServiceGraph.stories.tsx +262 -0
  171. package/src/components/waka-skeleton-wave/WakaSkeletonWave.stories.tsx +321 -0
  172. package/src/components/waka-skill-tree/WakaSkillTree.stories.tsx +308 -0
  173. package/src/components/waka-spin-wheel/WakaSpinWheel.stories.tsx +368 -0
  174. package/src/components/waka-spinner/WakaSpinner.stories.tsx +156 -0
  175. package/src/components/waka-stat/WakaStat.stories.tsx +334 -0
  176. package/src/components/waka-status-matrix/WakaStatusMatrix.stories.tsx +331 -0
  177. package/src/components/waka-stepper/WakaStepper.stories.tsx +468 -0
  178. package/src/components/waka-streak-counter/WakaStreakCounter.stories.tsx +235 -0
  179. package/src/components/waka-success-explosion/WakaSuccessExplosion.stories.tsx +389 -0
  180. package/src/components/waka-tabs-morph/WakaTabsMorph.stories.tsx +471 -0
  181. package/src/components/waka-terminal-output/WakaTerminalOutput.stories.tsx +351 -0
  182. package/src/components/waka-test-report/WakaTestReport.stories.tsx +322 -0
  183. package/src/components/waka-tilt-card/WakaTiltCard.stories.tsx +300 -0
  184. package/src/components/waka-time-picker/WakaTimePicker.stories.tsx +227 -0
  185. package/src/components/waka-timeline/WakaTimeline.stories.tsx +383 -0
  186. package/src/components/waka-tournament-bracket/WakaTournamentBracket.stories.tsx +375 -0
  187. package/src/components/waka-trace-viewer/WakaTraceViewer.stories.tsx +445 -0
  188. package/src/components/waka-tree/WakaTree.stories.tsx +359 -0
  189. package/src/components/waka-treemap-chart/WakaTreemapChart.stories.tsx +378 -0
  190. package/src/components/waka-typewriter/WakaTypewriter.stories.tsx +366 -0
  191. package/src/components/waka-versus-card/WakaVersusCard.stories.tsx +530 -0
  192. package/src/components/waka-video/WakaVideo.stories.tsx +203 -0
  193. package/src/components/waka-virtual-list/WakaVirtualList.stories.tsx +273 -0
  194. package/src/components/waka-xp-bar/WakaXPBar.stories.tsx +305 -0
@@ -0,0 +1,435 @@
1
+ import type { Meta, StoryObj } from '@storybook/react'
2
+ import { WakaPodCard, defaultPodDetails } from './index'
3
+ import type { PodDetails, PodPhase, ContainerState } from './index'
4
+ import * as React from 'react'
5
+
6
+ const pendingPod: PodDetails = {
7
+ name: 'worker-deployment-7c8d9e0f1a-b2c3d',
8
+ namespace: 'default',
9
+ phase: 'Pending',
10
+ nodeName: 'node-3',
11
+ startTime: new Date(Date.now() - 5 * 60 * 1000),
12
+ containers: [
13
+ {
14
+ name: 'worker',
15
+ image: 'myapp/worker:v2.0.0',
16
+ state: 'waiting',
17
+ ready: false,
18
+ restartCount: 0,
19
+ reason: 'ImagePullBackOff',
20
+ message: 'Back-off pulling image "myapp/worker:v2.0.0"',
21
+ },
22
+ ],
23
+ events: [
24
+ {
25
+ type: 'Normal',
26
+ reason: 'Scheduled',
27
+ message: 'Successfully assigned default/worker-deployment-7c8d9e0f1a-b2c3d to node-3',
28
+ timestamp: new Date(Date.now() - 5 * 60 * 1000),
29
+ },
30
+ {
31
+ type: 'Normal',
32
+ reason: 'Pulling',
33
+ message: 'Pulling image "myapp/worker:v2.0.0"',
34
+ timestamp: new Date(Date.now() - 4 * 60 * 1000),
35
+ },
36
+ {
37
+ type: 'Warning',
38
+ reason: 'Failed',
39
+ message: 'Failed to pull image "myapp/worker:v2.0.0": rpc error: code = NotFound',
40
+ timestamp: new Date(Date.now() - 3 * 60 * 1000),
41
+ },
42
+ {
43
+ type: 'Warning',
44
+ reason: 'Failed',
45
+ message: 'Error: ImagePullBackOff',
46
+ timestamp: new Date(Date.now() - 1 * 60 * 1000),
47
+ count: 5,
48
+ },
49
+ ],
50
+ labels: {
51
+ app: 'worker',
52
+ version: 'v2.0.0',
53
+ },
54
+ }
55
+
56
+ const failedPod: PodDetails = {
57
+ name: 'migration-job-abc123',
58
+ namespace: 'database',
59
+ phase: 'Failed',
60
+ nodeName: 'node-2',
61
+ podIP: '10.244.2.45',
62
+ hostIP: '192.168.1.11',
63
+ startTime: new Date(Date.now() - 30 * 60 * 1000),
64
+ containers: [
65
+ {
66
+ name: 'migrate',
67
+ image: 'myapp/migrations:v1.5.0',
68
+ state: 'terminated',
69
+ ready: false,
70
+ restartCount: 3,
71
+ reason: 'Error',
72
+ message: 'Exit code 1: Migration failed - duplicate key constraint',
73
+ },
74
+ ],
75
+ events: [
76
+ {
77
+ type: 'Warning',
78
+ reason: 'BackOff',
79
+ message: 'Back-off restarting failed container',
80
+ timestamp: new Date(Date.now() - 5 * 60 * 1000),
81
+ count: 3,
82
+ },
83
+ ],
84
+ labels: {
85
+ 'job-name': 'migration-job',
86
+ },
87
+ }
88
+
89
+ const multiContainerPod: PodDetails = {
90
+ name: 'web-app-5f6g7h8i9j-k0l1m',
91
+ namespace: 'production',
92
+ phase: 'Running',
93
+ nodeName: 'node-1',
94
+ podIP: '10.244.1.100',
95
+ hostIP: '192.168.1.10',
96
+ startTime: new Date(Date.now() - 7 * 24 * 3600000),
97
+ containers: [
98
+ {
99
+ name: 'nginx',
100
+ image: 'nginx:1.25-alpine',
101
+ state: 'running',
102
+ ready: true,
103
+ restartCount: 0,
104
+ startedAt: new Date(Date.now() - 7 * 24 * 3600000),
105
+ resources: {
106
+ cpu: { used: 25, limit: 100 },
107
+ memory: { used: 32 * 1024 * 1024, limit: 64 * 1024 * 1024 },
108
+ },
109
+ ports: [{ containerPort: 80, protocol: 'TCP' }],
110
+ },
111
+ {
112
+ name: 'app',
113
+ image: 'myapp/frontend:v3.2.1',
114
+ state: 'running',
115
+ ready: true,
116
+ restartCount: 1,
117
+ startedAt: new Date(Date.now() - 3 * 24 * 3600000),
118
+ resources: {
119
+ cpu: { used: 200, limit: 500 },
120
+ memory: { used: 384 * 1024 * 1024, limit: 512 * 1024 * 1024 },
121
+ },
122
+ ports: [
123
+ { containerPort: 3000, protocol: 'TCP' },
124
+ { containerPort: 9090, protocol: 'TCP' },
125
+ ],
126
+ },
127
+ {
128
+ name: 'envoy',
129
+ image: 'envoyproxy/envoy:v1.28.0',
130
+ state: 'running',
131
+ ready: true,
132
+ restartCount: 0,
133
+ startedAt: new Date(Date.now() - 7 * 24 * 3600000),
134
+ resources: {
135
+ cpu: { used: 75, limit: 200 },
136
+ memory: { used: 96 * 1024 * 1024, limit: 256 * 1024 * 1024 },
137
+ },
138
+ ports: [
139
+ { containerPort: 15000, protocol: 'TCP' },
140
+ { containerPort: 15001, protocol: 'TCP' },
141
+ ],
142
+ },
143
+ ],
144
+ labels: {
145
+ app: 'web-app',
146
+ version: 'v3.2.1',
147
+ environment: 'production',
148
+ team: 'frontend',
149
+ 'istio-injection': 'enabled',
150
+ 'prometheus.io/scrape': 'true',
151
+ },
152
+ annotations: {
153
+ 'prometheus.io/port': '9090',
154
+ 'prometheus.io/path': '/metrics',
155
+ },
156
+ }
157
+
158
+ const succeededPod: PodDetails = {
159
+ name: 'backup-cronjob-1234567890-abc',
160
+ namespace: 'database',
161
+ phase: 'Succeeded',
162
+ nodeName: 'node-2',
163
+ podIP: '10.244.2.88',
164
+ startTime: new Date(Date.now() - 2 * 3600000),
165
+ containers: [
166
+ {
167
+ name: 'backup',
168
+ image: 'myapp/backup:v1.0.0',
169
+ state: 'terminated',
170
+ ready: false,
171
+ restartCount: 0,
172
+ reason: 'Completed',
173
+ message: 'Container completed successfully',
174
+ },
175
+ ],
176
+ events: [
177
+ {
178
+ type: 'Normal',
179
+ reason: 'Completed',
180
+ message: 'Job completed successfully',
181
+ timestamp: new Date(Date.now() - 1 * 3600000),
182
+ },
183
+ ],
184
+ labels: {
185
+ 'job-name': 'backup-cronjob',
186
+ },
187
+ }
188
+
189
+ const meta: Meta<typeof WakaPodCard> = {
190
+ title: 'Components/DevOps/WakaPodCard',
191
+ component: WakaPodCard,
192
+ parameters: {
193
+ layout: 'centered',
194
+ docs: {
195
+ description: {
196
+ component: 'A Kubernetes pod card with container details, resource metrics, events, logs/exec buttons, and lifecycle actions.',
197
+ },
198
+ },
199
+ },
200
+ tags: ['autodocs'],
201
+ argTypes: {
202
+ showEvents: {
203
+ control: 'boolean',
204
+ description: 'Show events section',
205
+ },
206
+ compact: {
207
+ control: 'boolean',
208
+ description: 'Compact mode (hide labels)',
209
+ },
210
+ },
211
+ }
212
+
213
+ export default meta
214
+ type Story = StoryObj<typeof WakaPodCard>
215
+
216
+ export const Default: Story = {
217
+ args: {
218
+ pod: defaultPodDetails,
219
+ },
220
+ render: (args) => (
221
+ <div className="w-[500px]">
222
+ <WakaPodCard
223
+ {...args}
224
+ onViewLogs={(name) => console.log('View logs:', name)}
225
+ onExec={(name) => console.log('Exec:', name)}
226
+ onDelete={() => console.log('Delete')}
227
+ onRestart={() => console.log('Restart')}
228
+ />
229
+ </div>
230
+ ),
231
+ }
232
+
233
+ export const AllPhases: Story = {
234
+ render: () => {
235
+ const phases: PodPhase[] = ['Running', 'Pending', 'Succeeded', 'Failed', 'Unknown']
236
+ const pods: PodDetails[] = phases.map((phase) => ({
237
+ name: `example-pod-${phase.toLowerCase()}`,
238
+ namespace: 'default',
239
+ phase,
240
+ containers: [
241
+ {
242
+ name: 'container',
243
+ image: 'nginx:latest',
244
+ state: phase === 'Running' ? 'running' : phase === 'Pending' ? 'waiting' : 'terminated',
245
+ ready: phase === 'Running',
246
+ restartCount: 0,
247
+ },
248
+ ],
249
+ }))
250
+
251
+ return (
252
+ <div className="grid grid-cols-1 gap-4 w-[500px]">
253
+ {pods.map((pod) => (
254
+ <WakaPodCard key={pod.phase} pod={pod} />
255
+ ))}
256
+ </div>
257
+ )
258
+ },
259
+ }
260
+
261
+ export const Pending: Story = {
262
+ render: () => (
263
+ <div className="w-[500px]">
264
+ <WakaPodCard
265
+ pod={pendingPod}
266
+ onViewLogs={(name) => console.log('View logs:', name)}
267
+ onRestart={() => console.log('Restart')}
268
+ onDelete={() => console.log('Delete')}
269
+ />
270
+ </div>
271
+ ),
272
+ }
273
+
274
+ export const Failed: Story = {
275
+ render: () => (
276
+ <div className="w-[500px]">
277
+ <WakaPodCard
278
+ pod={failedPod}
279
+ onViewLogs={(name) => console.log('View logs:', name)}
280
+ onDelete={() => console.log('Delete')}
281
+ />
282
+ </div>
283
+ ),
284
+ }
285
+
286
+ export const Succeeded: Story = {
287
+ render: () => (
288
+ <div className="w-[500px]">
289
+ <WakaPodCard
290
+ pod={succeededPod}
291
+ onViewLogs={(name) => console.log('View logs:', name)}
292
+ onDelete={() => console.log('Delete')}
293
+ />
294
+ </div>
295
+ ),
296
+ }
297
+
298
+ export const MultipleContainers: Story = {
299
+ render: () => (
300
+ <div className="w-[550px]">
301
+ <WakaPodCard
302
+ pod={multiContainerPod}
303
+ onViewLogs={(name) => console.log('View logs:', name)}
304
+ onExec={(name) => console.log('Exec:', name)}
305
+ onDelete={() => console.log('Delete')}
306
+ onRestart={() => console.log('Restart')}
307
+ />
308
+ </div>
309
+ ),
310
+ }
311
+
312
+ export const NoEvents: Story = {
313
+ render: () => (
314
+ <div className="w-[500px]">
315
+ <WakaPodCard
316
+ pod={defaultPodDetails}
317
+ showEvents={false}
318
+ onViewLogs={(name) => console.log('View logs:', name)}
319
+ onExec={(name) => console.log('Exec:', name)}
320
+ />
321
+ </div>
322
+ ),
323
+ }
324
+
325
+ export const Compact: Story = {
326
+ render: () => (
327
+ <div className="w-[500px]">
328
+ <WakaPodCard
329
+ pod={multiContainerPod}
330
+ compact
331
+ onViewLogs={(name) => console.log('View logs:', name)}
332
+ onExec={(name) => console.log('Exec:', name)}
333
+ />
334
+ </div>
335
+ ),
336
+ }
337
+
338
+ export const NoActions: Story = {
339
+ render: () => (
340
+ <div className="w-[500px]">
341
+ <p className="text-sm text-muted-foreground mb-4">
342
+ Read-only view without action buttons
343
+ </p>
344
+ <WakaPodCard pod={defaultPodDetails} />
345
+ </div>
346
+ ),
347
+ }
348
+
349
+ export const HighResourceUsage: Story = {
350
+ render: () => {
351
+ const highUsagePod: PodDetails = {
352
+ name: 'memory-hungry-app-xyz123',
353
+ namespace: 'default',
354
+ phase: 'Running',
355
+ nodeName: 'node-1',
356
+ podIP: '10.244.1.50',
357
+ startTime: new Date(Date.now() - 1 * 3600000),
358
+ containers: [
359
+ {
360
+ name: 'app',
361
+ image: 'myapp/heavy:latest',
362
+ state: 'running',
363
+ ready: true,
364
+ restartCount: 2,
365
+ resources: {
366
+ cpu: { used: 950, limit: 1000 },
367
+ memory: { used: 1900 * 1024 * 1024, limit: 2048 * 1024 * 1024 },
368
+ },
369
+ },
370
+ ],
371
+ events: [
372
+ {
373
+ type: 'Warning',
374
+ reason: 'OOMKilled',
375
+ message: 'Container killed due to out of memory',
376
+ timestamp: new Date(Date.now() - 30 * 60 * 1000),
377
+ count: 2,
378
+ },
379
+ ],
380
+ }
381
+
382
+ return (
383
+ <div className="w-[500px]">
384
+ <p className="text-sm text-muted-foreground mb-4">
385
+ Pod with high resource utilization
386
+ </p>
387
+ <WakaPodCard
388
+ pod={highUsagePod}
389
+ onViewLogs={(name) => console.log('View logs:', name)}
390
+ onRestart={() => console.log('Restart')}
391
+ />
392
+ </div>
393
+ )
394
+ },
395
+ }
396
+
397
+ export const PodDetailsPanel: Story = {
398
+ render: () => (
399
+ <div className="p-6 rounded-xl border bg-card">
400
+ <div className="flex items-center justify-between mb-6">
401
+ <div>
402
+ <h2 className="text-xl font-bold">Pod Details</h2>
403
+ <p className="text-sm text-muted-foreground">Namespace: production</p>
404
+ </div>
405
+ <div className="flex items-center gap-2">
406
+ <div className="w-2 h-2 rounded-full bg-green-500" />
407
+ <span className="text-sm text-green-500 font-medium">Healthy</span>
408
+ </div>
409
+ </div>
410
+
411
+ <div className="w-[500px]">
412
+ <WakaPodCard
413
+ pod={multiContainerPod}
414
+ onViewLogs={(name) => {
415
+ console.log('View logs:', name)
416
+ alert(`Opening logs for container: ${name}`)
417
+ }}
418
+ onExec={(name) => {
419
+ console.log('Exec:', name)
420
+ alert(`Opening terminal for container: ${name}`)
421
+ }}
422
+ onDelete={() => {
423
+ if (confirm('Are you sure you want to delete this pod?')) {
424
+ console.log('Delete confirmed')
425
+ }
426
+ }}
427
+ onRestart={() => {
428
+ console.log('Restart')
429
+ alert('Pod will be restarted')
430
+ }}
431
+ />
432
+ </div>
433
+ </div>
434
+ ),
435
+ }
@@ -0,0 +1,232 @@
1
+ import type { Meta, StoryObj } from '@storybook/react'
2
+ import { WakaQRCode } from './index'
3
+ import * as React from 'react'
4
+
5
+ const meta: Meta<typeof WakaQRCode> = {
6
+ title: 'Components/Display/WakaQRCode',
7
+ component: WakaQRCode,
8
+ parameters: {
9
+ layout: 'centered',
10
+ docs: {
11
+ description: {
12
+ component: 'A QR code generator component with customizable colors, logo support, and download/copy actions.',
13
+ },
14
+ },
15
+ },
16
+ tags: ['autodocs'],
17
+ argTypes: {
18
+ size: {
19
+ control: { type: 'range', min: 100, max: 400, step: 20 },
20
+ description: 'Size in pixels',
21
+ },
22
+ errorCorrectionLevel: {
23
+ control: 'select',
24
+ options: ['L', 'M', 'Q', 'H'],
25
+ description: 'Error correction level',
26
+ },
27
+ fgColor: {
28
+ control: 'color',
29
+ description: 'Foreground color',
30
+ },
31
+ bgColor: {
32
+ control: 'color',
33
+ description: 'Background color',
34
+ },
35
+ includeMargin: {
36
+ control: 'boolean',
37
+ description: 'Include margin around QR code',
38
+ },
39
+ showActions: {
40
+ control: 'boolean',
41
+ description: 'Show download and copy actions',
42
+ },
43
+ },
44
+ }
45
+
46
+ export default meta
47
+ type Story = StoryObj<typeof WakaQRCode>
48
+
49
+ export const Default: Story = {
50
+ args: {
51
+ value: 'https://example.com',
52
+ size: 200,
53
+ },
54
+ }
55
+
56
+ export const WithActions: Story = {
57
+ args: {
58
+ value: 'https://example.com',
59
+ size: 200,
60
+ showActions: true,
61
+ },
62
+ }
63
+
64
+ export const Sizes: Story = {
65
+ render: () => (
66
+ <div className="flex items-end gap-8">
67
+ <div className="text-center">
68
+ <WakaQRCode value="https://example.com" size={100} />
69
+ <p className="text-xs text-muted-foreground mt-2">100px</p>
70
+ </div>
71
+ <div className="text-center">
72
+ <WakaQRCode value="https://example.com" size={150} />
73
+ <p className="text-xs text-muted-foreground mt-2">150px</p>
74
+ </div>
75
+ <div className="text-center">
76
+ <WakaQRCode value="https://example.com" size={200} />
77
+ <p className="text-xs text-muted-foreground mt-2">200px</p>
78
+ </div>
79
+ <div className="text-center">
80
+ <WakaQRCode value="https://example.com" size={250} />
81
+ <p className="text-xs text-muted-foreground mt-2">250px</p>
82
+ </div>
83
+ </div>
84
+ ),
85
+ }
86
+
87
+ export const CustomColors: Story = {
88
+ render: () => (
89
+ <div className="grid grid-cols-3 gap-8">
90
+ <div className="text-center">
91
+ <WakaQRCode value="https://example.com" size={150} fgColor="#000000" bgColor="#FFFFFF" />
92
+ <p className="text-xs text-muted-foreground mt-2">Default</p>
93
+ </div>
94
+ <div className="text-center">
95
+ <WakaQRCode value="https://example.com" size={150} fgColor="#1E40AF" bgColor="#DBEAFE" />
96
+ <p className="text-xs text-muted-foreground mt-2">Blue</p>
97
+ </div>
98
+ <div className="text-center">
99
+ <WakaQRCode value="https://example.com" size={150} fgColor="#15803D" bgColor="#DCFCE7" />
100
+ <p className="text-xs text-muted-foreground mt-2">Green</p>
101
+ </div>
102
+ <div className="text-center">
103
+ <WakaQRCode value="https://example.com" size={150} fgColor="#7C3AED" bgColor="#EDE9FE" />
104
+ <p className="text-xs text-muted-foreground mt-2">Purple</p>
105
+ </div>
106
+ <div className="text-center">
107
+ <WakaQRCode value="https://example.com" size={150} fgColor="#DC2626" bgColor="#FEE2E2" />
108
+ <p className="text-xs text-muted-foreground mt-2">Red</p>
109
+ </div>
110
+ <div className="text-center">
111
+ <WakaQRCode value="https://example.com" size={150} fgColor="#FFFFFF" bgColor="#1F2937" />
112
+ <p className="text-xs text-muted-foreground mt-2">Inverted</p>
113
+ </div>
114
+ </div>
115
+ ),
116
+ }
117
+
118
+ export const ErrorCorrectionLevels: Story = {
119
+ render: () => (
120
+ <div className="grid grid-cols-2 gap-8">
121
+ <div className="text-center">
122
+ <WakaQRCode value="https://example.com" size={150} errorCorrectionLevel="L" />
123
+ <p className="text-xs text-muted-foreground mt-2">Low (L) - 7%</p>
124
+ </div>
125
+ <div className="text-center">
126
+ <WakaQRCode value="https://example.com" size={150} errorCorrectionLevel="M" />
127
+ <p className="text-xs text-muted-foreground mt-2">Medium (M) - 15%</p>
128
+ </div>
129
+ <div className="text-center">
130
+ <WakaQRCode value="https://example.com" size={150} errorCorrectionLevel="Q" />
131
+ <p className="text-xs text-muted-foreground mt-2">Quartile (Q) - 25%</p>
132
+ </div>
133
+ <div className="text-center">
134
+ <WakaQRCode value="https://example.com" size={150} errorCorrectionLevel="H" />
135
+ <p className="text-xs text-muted-foreground mt-2">High (H) - 30%</p>
136
+ </div>
137
+ </div>
138
+ ),
139
+ }
140
+
141
+ export const WithLogo: Story = {
142
+ args: {
143
+ value: 'https://example.com',
144
+ size: 250,
145
+ logoUrl: 'https://via.placeholder.com/50',
146
+ logoSize: 0.2,
147
+ },
148
+ }
149
+
150
+ export const NoMargin: Story = {
151
+ render: () => (
152
+ <div className="flex gap-8 items-center">
153
+ <div className="text-center border p-2">
154
+ <WakaQRCode value="https://example.com" size={150} includeMargin={true} />
155
+ <p className="text-xs text-muted-foreground mt-2">With Margin</p>
156
+ </div>
157
+ <div className="text-center border p-2">
158
+ <WakaQRCode value="https://example.com" size={150} includeMargin={false} />
159
+ <p className="text-xs text-muted-foreground mt-2">No Margin</p>
160
+ </div>
161
+ </div>
162
+ ),
163
+ }
164
+
165
+ export const DifferentContent: Story = {
166
+ render: () => (
167
+ <div className="grid grid-cols-2 gap-8">
168
+ <div className="text-center">
169
+ <WakaQRCode value="https://github.com" size={150} />
170
+ <p className="text-xs text-muted-foreground mt-2">URL</p>
171
+ </div>
172
+ <div className="text-center">
173
+ <WakaQRCode value="tel:+1234567890" size={150} />
174
+ <p className="text-xs text-muted-foreground mt-2">Phone Number</p>
175
+ </div>
176
+ <div className="text-center">
177
+ <WakaQRCode value="mailto:contact@example.com" size={150} />
178
+ <p className="text-xs text-muted-foreground mt-2">Email</p>
179
+ </div>
180
+ <div className="text-center">
181
+ <WakaQRCode value="WIFI:S:MyNetwork;T:WPA;P:password123;;" size={150} />
182
+ <p className="text-xs text-muted-foreground mt-2">WiFi</p>
183
+ </div>
184
+ </div>
185
+ ),
186
+ }
187
+
188
+ export const ContactCard: Story = {
189
+ render: () => (
190
+ <div className="border rounded-lg p-6 w-[350px]">
191
+ <div className="flex items-start gap-4">
192
+ <WakaQRCode
193
+ value="BEGIN:VCARD
194
+ VERSION:3.0
195
+ N:Doe;John
196
+ FN:John Doe
197
+ ORG:Acme Inc
198
+ TITLE:Developer
199
+ TEL:+1-555-123-4567
200
+ EMAIL:john@example.com
201
+ END:VCARD"
202
+ size={120}
203
+ />
204
+ <div>
205
+ <h3 className="font-semibold">John Doe</h3>
206
+ <p className="text-sm text-muted-foreground">Developer at Acme Inc</p>
207
+ <p className="text-sm mt-2">+1-555-123-4567</p>
208
+ <p className="text-sm text-blue-600">john@example.com</p>
209
+ </div>
210
+ </div>
211
+ <p className="text-xs text-muted-foreground mt-4">Scan to save contact</p>
212
+ </div>
213
+ ),
214
+ }
215
+
216
+ export const TicketQRCode: Story = {
217
+ render: () => (
218
+ <div className="border rounded-lg overflow-hidden w-[300px]">
219
+ <div className="bg-primary p-4 text-primary-foreground">
220
+ <h3 className="font-semibold">Event Ticket</h3>
221
+ <p className="text-sm opacity-90">Tech Conference 2024</p>
222
+ </div>
223
+ <div className="p-4 flex flex-col items-center">
224
+ <WakaQRCode value="TICKET-2024-001-ABCD" size={180} showActions />
225
+ <div className="mt-4 text-center">
226
+ <p className="text-sm font-medium">Ticket #001-ABCD</p>
227
+ <p className="text-xs text-muted-foreground">Present this QR code at entry</p>
228
+ </div>
229
+ </div>
230
+ </div>
231
+ ),
232
+ }