Skip to content

Commit

Permalink
feat: add version info to UI
Browse files Browse the repository at this point in the history
  • Loading branch information
xiangechen committed Aug 11, 2024
1 parent 4f681b3 commit 88fa041
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 1 deletion.
7 changes: 7 additions & 0 deletions packages/chili-ui/src/home/home.module.css
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,13 @@
font-weight: bold;
font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
}

.version {
font-size: 14px;
margin-top: 4px;
letter-spacing: 0px;
opacity: 0.56;
}
}
}

Expand Down
4 changes: 4 additions & 0 deletions packages/chili-ui/src/home/home.ts
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,10 @@ export class Home extends HTMLElement {
span({
textContent: "CHILI3D",
}),
span({
className: style.version,
textContent: __APP_VERSION__,
}),
),
collection({
className: style.buttons,
Expand Down
2 changes: 1 addition & 1 deletion packages/chili-ui/src/ribbon/ribbon.ts
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ export class Ribbon extends HTMLElement {
className: style.icon,
icon: "icon-chili",
}),
span({ textContent: "Chili3D 2024 - dev" }),
span({ textContent: `Chili3D - v${__APP_VERSION__}` }),
),
),
div(
Expand Down
2 changes: 2 additions & 0 deletions packages/global.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,3 +24,5 @@ declare module "*.jpg" {
const path: string;
export default path;
}

declare var __APP_VERSION__: string;
3 changes: 3 additions & 0 deletions rspack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,9 @@ const config = defineConfig({
},
],
}),
new rspack.DefinePlugin({
__APP_VERSION__: JSON.stringify(require("./package.json").version),
}),
new rspack.HtmlRspackPlugin({
template: "./public/index.html",
inject: "body",
Expand Down

0 comments on commit 88fa041

Please sign in to comment.