Skip to content

Commit

Permalink
feat: Initial VersionInfo component
Browse files Browse the repository at this point in the history
Co-authored-by: AWildErin <[email protected]>
  • Loading branch information
JJL772 and AWildErin committed Feb 23, 2024
1 parent 9a6e6f3 commit 16759b1
Show file tree
Hide file tree
Showing 4 changed files with 52 additions and 0 deletions.
17 changes: 17 additions & 0 deletions layout/components/version-info.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<root>
<styles>
<include src="file://{resources}/styles/components/version-info.scss" />
</styles>
<scripts>
<include src="file://{resources}/scripts/components/version-info.js" />
</scripts>

<Panel class="VersionInfo" onload="VersionInfo.update()">
<Label class="VersionInfoText" text="{s:graphics}" />
<Label class="VersionInfoText" text="{s:version}" />
<Label class="VersionInfoText" text="{s:branch}" />
<Label class="VersionInfoText" text="{s:platform}" />
<Label class="VersionInfoText" text="{s:physics}" />
</Panel>
</root>

25 changes: 25 additions & 0 deletions scripts/components/version-info.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
'use strict';

class VersionInfo {
static {
$.GetContextPanel().jsClass = this;
}

static update() {
const cp = $.GetContextPanel();

const graphics = VersionAPI.GetGraphicsAPI();
const version = VersionAPI.GetVersion();
const branch = VersionAPI.GetBranch();
const platform = VersionAPI.GetPlatform();
const physics = VersionAPI.GetPhysicsEngine();

// Set the dialog variables so this can be used in label
cp.SetDialogVariable("graphics", graphics);
cp.SetDialogVariable("version", version);
cp.SetDialogVariable("branch", branch);
cp.SetDialogVariable("platform", platform);
cp.SetDialogVariable("physics", physics);
}
}

1 change: 1 addition & 0 deletions scripts/util/panel-registration.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@
//--------------------------------------------------------------------------------------------------

UiToolkitAPI.RegisterPanel2d('LineGraph', 'file://{resources}/layout/components/graphs/line-graph.xml');
UiToolkitAPI.RegisterPanel2d('VersionInfo', 'file://{resources}/layout/components/version-info.xml');
9 changes: 9 additions & 0 deletions styles/components/version-info.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
.VersionInfo {
flow-children: down;

.VersionInfoText {
font-size: 18px;
}

color: black;
}

0 comments on commit 16759b1

Please sign in to comment.