Skip to content

Commit 3db3dcd

Browse files
committed
feat: made theming nicer, trying to work out why the database won't show
1 parent 9c63c25 commit 3db3dcd

File tree

4 files changed

+73
-15
lines changed

4 files changed

+73
-15
lines changed

examples/gauge/Components/InterfaceSample.tsx

Lines changed: 18 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import {
2+
ArraySubject,
23
ComponentProps,
34
DisplayComponent,
45
EventBus,
@@ -19,8 +20,10 @@ import { AuthService } from "../Services/AuthService"
1920
import { Dropdown } from "./Dropdown"
2021
import { Input } from "./Input"
2122
import "./InterfaceSample.css"
23+
import { AuthPage } from "./Pages/Auth/Auth"
2224
import { Dashboard } from "./Pages/Dashboard/Dashboard"
23-
import { Button, InterfaceNavbar, InterfaceSwitch } from "./Utils"
25+
import { TestPage } from "./Pages/Test/Test"
26+
import { InterfaceNavbar, InterfaceSwitch } from "./Utils"
2427

2528
interface InterfaceSampleProps extends ComponentProps {
2629
bus: EventBus
@@ -43,6 +46,7 @@ export class InterfaceSample extends DisplayComponent<InterfaceSampleProps> {
4346
private readonly authContainerRef = FSComponent.createRef<HTMLDivElement>()
4447

4548
private readonly activeDatabase = Subject.create<PackageInfo | null>(null)
49+
private readonly databases = Subject.create<PackageInfo[]>([])
4650
private readonly mainPageIndex = Subject.create(0)
4751

4852
private cancelSource = CancelToken.source()
@@ -94,12 +98,6 @@ export class InterfaceSample extends DisplayComponent<InterfaceSampleProps> {
9498
)
9599
}
96100

97-
private readonly buttons: [number, string][] = [
98-
[0, "Page 1"],
99-
[1, "Page 2"],
100-
[2, "Page 3"],
101-
]
102-
103101
public render(): VNode {
104102
return (
105103
<>
@@ -112,9 +110,9 @@ export class InterfaceSample extends DisplayComponent<InterfaceSampleProps> {
112110
<div class="h-full w-[7rem]">
113111
<InterfaceNavbar
114112
tabs={[
115-
[0, "Page 1"],
116-
[1, "Page 2"],
117-
[2, "Page 3"],
113+
[0, "Dash"],
114+
[1, "Test"],
115+
[2, "Auth"],
118116
]}
119117
setActive={pageNumber => this.mainPageIndex.set(pageNumber)}
120118
active={this.mainPageIndex}
@@ -124,9 +122,9 @@ export class InterfaceSample extends DisplayComponent<InterfaceSampleProps> {
124122
class="bg-ng-background-400"
125123
active={this.mainPageIndex}
126124
pages={[
127-
[0, <Dashboard />],
128-
[1, <p class="text-xl">Hi2</p>],
129-
[2, <p class="text-xl">Hi3</p>],
125+
[0, <Dashboard databases={this.databases} />],
126+
[1, <TestPage />],
127+
[2, <AuthPage />],
130128
]}
131129
/>
132130
</div>
@@ -189,6 +187,13 @@ export class InterfaceSample extends DisplayComponent<InterfaceSampleProps> {
189187
// Populate status when ready
190188
this.navigationDataInterface.onReady(async () => {
191189
this.activeDatabase.set(await this.navigationDataInterface.get_active_package())
190+
this.navigationDataInterface
191+
.list_available_packages(true)
192+
.then(pkgs => {
193+
this.databases.set(pkgs)
194+
})
195+
.catch(err => console.error(`Error setting databases: ${err}`))
196+
192197
// show the auth container
193198
this.authContainerRef.instance.style.display = "block"
194199
this.loadingRef.instance.style.display = "none"
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
import { ComponentProps, DisplayComponent, FSComponent, VNode } from "@microsoft/msfs-sdk"
2+
3+
interface AuthPageProps extends ComponentProps {}
4+
5+
export class AuthPage extends DisplayComponent<AuthPageProps> {
6+
render(): VNode {
7+
return (
8+
<div class="size-full flex flex-col">
9+
<p class="mb-8 text-4xl">Authentication</p>
10+
</div>
11+
)
12+
}
13+
}
Lines changed: 29 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,36 @@
11
import { ComponentProps, DisplayComponent, FSComponent, Subscribable, VNode } from "@microsoft/msfs-sdk"
2+
import { PackageInfo } from "@navigraph/msfs-navigation-data-interface"
23

3-
interface DashboardProps extends ComponentProps {}
4+
interface DashboardProps extends ComponentProps {
5+
databases: Subscribable<PackageInfo[]>
6+
}
47

58
export class Dashboard extends DisplayComponent<DashboardProps> {
69
render(): VNode {
7-
return <p class="text-3xl">Dashboard</p>
10+
return (
11+
<div class="size-full flex flex-col">
12+
<p class="mb-8 text-4xl">Dashboard</p>
13+
<div class="flex flex-row flex-grow flex-auto space-x-4">
14+
<div class="w-1/3 flex flex-col">
15+
<p class="text-2xl mb-4">Databases</p>
16+
<div class="mt-2 flex-grow rounded-xl bg-ng-background-500">
17+
{this.props.databases.map(val =>
18+
val.map(pkgs => (
19+
<div class="p-2">
20+
<p class="text-lg">
21+
{pkgs.cycle.cycle} - {pkgs.cycle.format}
22+
</p>
23+
</div>
24+
)),
25+
)}
26+
</div>
27+
</div>
28+
<div class="flex flex-col flex-grow">
29+
<p class="text-2xl mb-4">Info</p>
30+
<div class="mt-2 flex-grow rounded-xl bg-ng-background-500"></div>
31+
</div>
32+
</div>
33+
</div>
34+
)
835
}
936
}
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
import { ComponentProps, DisplayComponent, FSComponent, VNode } from "@microsoft/msfs-sdk"
2+
3+
interface TestPageProps extends ComponentProps {}
4+
5+
export class TestPage extends DisplayComponent<TestPageProps> {
6+
render(): VNode {
7+
return (
8+
<div class="size-full flex flex-col">
9+
<p class="mb-8 text-4xl">Test</p>
10+
</div>
11+
)
12+
}
13+
}

0 commit comments

Comments
 (0)