11import {
2+ ArraySubject ,
23 ComponentProps ,
34 DisplayComponent ,
45 EventBus ,
@@ -19,8 +20,10 @@ import { AuthService } from "../Services/AuthService"
1920import { Dropdown } from "./Dropdown"
2021import { Input } from "./Input"
2122import "./InterfaceSample.css"
23+ import { AuthPage } from "./Pages/Auth/Auth"
2224import { 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
2528interface 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"
0 commit comments