create-skybridge 0.0.0-dev.b0a1d24 → 0.0.0-dev.b0d461b
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/index.js +332 -194
- package/package.json +10 -9
- package/templates/blank/.dockerignore +4 -0
- package/templates/blank/AGENTS.md +1 -0
- package/templates/blank/Dockerfile +53 -0
- package/templates/blank/README.md +92 -0
- package/templates/blank/_gitignore +7 -0
- package/templates/blank/alpic.json +3 -0
- package/templates/blank/node_modules/.bin/alpic +21 -0
- package/templates/blank/node_modules/.bin/sb +21 -0
- package/templates/blank/node_modules/.bin/skybridge +21 -0
- package/templates/blank/node_modules/.bin/tsc +21 -0
- package/templates/blank/node_modules/.bin/tsserver +21 -0
- package/templates/blank/node_modules/.bin/tsx +21 -0
- package/templates/blank/node_modules/.bin/vite +21 -0
- package/templates/blank/package.json +29 -0
- package/templates/blank/src/helpers.ts +4 -0
- package/templates/blank/src/server.ts +16 -0
- package/templates/blank/tsconfig.json +5 -0
- package/templates/blank/vite.config.ts +6 -0
- package/templates/demo/.dockerignore +4 -0
- package/templates/demo/AGENTS.md +1 -0
- package/templates/demo/Dockerfile +53 -0
- package/templates/demo/README.md +95 -0
- package/templates/demo/_gitignore +7 -0
- package/templates/demo/alpic.json +3 -0
- package/templates/demo/node_modules/.bin/alpic +21 -0
- package/templates/demo/node_modules/.bin/sb +21 -0
- package/templates/demo/node_modules/.bin/skybridge +21 -0
- package/templates/demo/node_modules/.bin/tsc +21 -0
- package/templates/demo/node_modules/.bin/tsserver +21 -0
- package/templates/demo/node_modules/.bin/tsx +21 -0
- package/templates/demo/node_modules/.bin/vite +21 -0
- package/templates/demo/package.json +41 -0
- package/templates/demo/src/helpers.ts +4 -0
- package/templates/demo/src/index.css +59 -0
- package/templates/demo/src/server.ts +94 -0
- package/templates/demo/src/views/components/doc-link.tsx +22 -0
- package/templates/demo/src/views/components/doc.tsx +21 -0
- package/templates/demo/src/views/components/nav.tsx +31 -0
- package/templates/demo/src/views/components/progress.tsx +35 -0
- package/templates/demo/src/views/components/steps/outro.tsx +68 -0
- package/templates/demo/src/views/components/steps/state.tsx +47 -0
- package/templates/demo/src/views/components/steps/tool-call.tsx +53 -0
- package/templates/demo/src/views/components/steps/tool-output.tsx +40 -0
- package/templates/demo/src/views/images/mascot/beret.png +0 -0
- package/templates/demo/src/views/images/mascot/chapka.png +0 -0
- package/templates/demo/src/views/images/mascot/cowboy-hat.png +0 -0
- package/templates/demo/src/views/images/mascot/fez.png +0 -0
- package/templates/demo/src/views/images/mascot/jester-hat.png +0 -0
- package/templates/demo/src/views/images/mascot/mitre.png +0 -0
- package/templates/demo/src/views/images/mascot/non-la.png +0 -0
- package/templates/demo/src/views/images/mascot/original.png +0 -0
- package/templates/demo/src/views/images/mascot/propeller-beanie.png +0 -0
- package/templates/demo/src/views/images/mascot/ski-mask.png +0 -0
- package/templates/demo/src/views/images/mascot/sombrero.png +0 -0
- package/templates/demo/src/views/images/mascot/top-hat.png +0 -0
- package/templates/demo/src/views/images/mascot/viking-helmet.png +0 -0
- package/templates/demo/src/views/onboarding.tsx +63 -0
- package/templates/demo/src/views/use-mascot.ts +60 -0
- package/templates/demo/tsconfig.json +11 -0
- package/{template-ecom/web → templates/demo}/vite.config.ts +3 -4
- package/dist/index.test.d.ts +0 -1
- package/dist/index.test.js +0 -23
- package/template/README.md +0 -77
- package/template/alpic.json +0 -4
- package/template/node_modules/.bin/mcp-inspector +0 -21
- package/template/node_modules/.bin/nodemon +0 -21
- package/template/node_modules/.bin/shx +0 -21
- package/template/node_modules/.bin/tsc +0 -21
- package/template/node_modules/.bin/tsserver +0 -21
- package/template/node_modules/.bin/tsx +0 -21
- package/template/node_modules/.bin/vite +0 -21
- package/template/nodemon.json +0 -5
- package/template/package.json +0 -42
- package/template/server/src/index.ts +0 -39
- package/template/server/src/middleware.ts +0 -54
- package/template/server/src/server.ts +0 -61
- package/template/tsconfig.json +0 -23
- package/template/tsconfig.server.json +0 -11
- package/template/web/src/helpers.ts +0 -4
- package/template/web/src/index.css +0 -31
- package/template/web/src/widgets/magic-8-ball.tsx +0 -24
- package/template/web/vite.config.ts +0 -15
- package/template-ecom/README.md +0 -86
- package/template-ecom/alpic.json +0 -4
- package/template-ecom/nodemon.json +0 -5
- package/template-ecom/package.json +0 -40
- package/template-ecom/server/src/index.ts +0 -39
- package/template-ecom/server/src/middleware.ts +0 -54
- package/template-ecom/server/src/server.ts +0 -73
- package/template-ecom/tsconfig.json +0 -23
- package/template-ecom/tsconfig.server.json +0 -11
- package/template-ecom/web/src/helpers.ts +0 -4
- package/template-ecom/web/src/index.css +0 -178
- package/template-ecom/web/src/widgets/ecom-carousel.tsx +0 -109
|
@@ -1,109 +0,0 @@
|
|
|
1
|
-
import "@/index.css";
|
|
2
|
-
|
|
3
|
-
import { useState } from "react";
|
|
4
|
-
import { mountWidget, useLayout, useUser } from "skybridge/web";
|
|
5
|
-
import { useToolInfo } from "../helpers.js";
|
|
6
|
-
|
|
7
|
-
const translations: Record<string, Record<string, string>> = {
|
|
8
|
-
en: {
|
|
9
|
-
loading: "Loading products...",
|
|
10
|
-
noProducts: "No product found",
|
|
11
|
-
},
|
|
12
|
-
fr: {
|
|
13
|
-
loading: "Chargement des produits...",
|
|
14
|
-
noProducts: "Aucun produit trouvé",
|
|
15
|
-
},
|
|
16
|
-
es: {
|
|
17
|
-
loading: "Cargando productos...",
|
|
18
|
-
noProducts: "No se encontraron productos",
|
|
19
|
-
},
|
|
20
|
-
de: {
|
|
21
|
-
loading: "Produkte werden geladen...",
|
|
22
|
-
noProducts: "Keine Produkte gefunden",
|
|
23
|
-
},
|
|
24
|
-
};
|
|
25
|
-
|
|
26
|
-
function EcomCarousel() {
|
|
27
|
-
const { theme } = useLayout();
|
|
28
|
-
const { locale } = useUser();
|
|
29
|
-
|
|
30
|
-
const lang = locale?.split("-")[0] ?? "en";
|
|
31
|
-
|
|
32
|
-
function translate(key: string) {
|
|
33
|
-
return translations[lang]?.[key] ?? translations.en[key];
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
const { output, isPending } = useToolInfo<"ecom-carousel">();
|
|
37
|
-
type Product = NonNullable<typeof output>["products"][number];
|
|
38
|
-
const [selected, setSelected] = useState<Product | null>(null);
|
|
39
|
-
|
|
40
|
-
function cn(...classes: string[]) {
|
|
41
|
-
return [theme, ...classes].filter(Boolean).join(" ");
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
if (isPending) {
|
|
45
|
-
return (
|
|
46
|
-
<div className={cn("container")}>
|
|
47
|
-
<div className={cn("message")}>{translate("loading")}</div>
|
|
48
|
-
</div>
|
|
49
|
-
);
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
if (!output || output.products.length === 0) {
|
|
53
|
-
return (
|
|
54
|
-
<div className={cn("container")}>
|
|
55
|
-
<div className={cn("message")}>{translate("noProducts")}</div>
|
|
56
|
-
</div>
|
|
57
|
-
);
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
const activeProduct = selected ?? output.products[0];
|
|
61
|
-
|
|
62
|
-
return (
|
|
63
|
-
<div className={cn("container")}>
|
|
64
|
-
<div className={cn("carousel")}>
|
|
65
|
-
{output.products.map((product) => (
|
|
66
|
-
<button
|
|
67
|
-
type="button"
|
|
68
|
-
key={product.id}
|
|
69
|
-
className={cn(
|
|
70
|
-
"product-card",
|
|
71
|
-
activeProduct?.id === product.id ? "selected" : "",
|
|
72
|
-
)}
|
|
73
|
-
onClick={() =>
|
|
74
|
-
setSelected(selected?.id === product.id ? null : product)
|
|
75
|
-
}
|
|
76
|
-
>
|
|
77
|
-
<img
|
|
78
|
-
src={product.image}
|
|
79
|
-
alt={product.title}
|
|
80
|
-
className={cn("product-image")}
|
|
81
|
-
/>
|
|
82
|
-
<div className={cn("product-info")}>
|
|
83
|
-
<div className={cn("product-title")}>{product.title}</div>
|
|
84
|
-
<div className={cn("product-price")}>
|
|
85
|
-
${product.price.toFixed(2)}
|
|
86
|
-
</div>
|
|
87
|
-
</div>
|
|
88
|
-
</button>
|
|
89
|
-
))}
|
|
90
|
-
</div>
|
|
91
|
-
{activeProduct && (
|
|
92
|
-
<div className={cn("product-detail")}>
|
|
93
|
-
<div className={cn("detail-title")}>{activeProduct.title}</div>
|
|
94
|
-
<div className={cn("detail-rating")}>
|
|
95
|
-
⭐ {activeProduct.rating.rate} ({activeProduct.rating.count}{" "}
|
|
96
|
-
reviews)
|
|
97
|
-
</div>
|
|
98
|
-
<div className={cn("detail-description")}>
|
|
99
|
-
{activeProduct.description}
|
|
100
|
-
</div>
|
|
101
|
-
</div>
|
|
102
|
-
)}
|
|
103
|
-
</div>
|
|
104
|
-
);
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
export default EcomCarousel;
|
|
108
|
-
|
|
109
|
-
mountWidget(<EcomCarousel />);
|