Add a server instance selector and drop env vars

This commit is contained in:
Paul Frazee 2022-11-15 15:09:50 -06:00
parent 9a6df95ade
commit 3725a2eed1
14 changed files with 383 additions and 174 deletions

View file

@ -3,14 +3,12 @@ import {sessionClient as AtpApi} from '../third-party/api'
import {RootStoreModel} from './models/root-store'
import * as libapi from './lib/api'
import * as storage from './lib/storage'
import {BUILD} from '../env'
export const DEFAULT_SERVICE =
BUILD === 'prod'
? 'http://localhost:2583' // TODO
: BUILD === 'staging'
? 'https://pds.staging.bsky.dev' // TODO
: 'http://localhost:2583'
export const IS_PROD_BUILD = true
export const LOCAL_DEV_SERVICE = 'http://localhost:2583'
export const STAGING_SERVICE = 'https://pds.staging.bsky.dev'
export const PROD_SERVICE = 'https://plc.bsky.social'
export const DEFAULT_SERVICE = IS_PROD_BUILD ? PROD_SERVICE : LOCAL_DEV_SERVICE
const ROOT_STATE_STORAGE_KEY = 'root'
const STATE_FETCH_INTERVAL = 15e3

View file

@ -66,6 +66,17 @@ export class InviteToSceneModel {
}
}
export class ServerInputModel {
name = 'server-input'
constructor(
public initialService: string,
public onSelect: (url: string) => void,
) {
makeAutoObservable(this)
}
}
export interface ComposerOpts {
replyTo?: Post.PostRef
onPost?: () => void
@ -79,6 +90,7 @@ export class ShellUiModel {
| SharePostModel
| EditProfileModel
| CreateSceneModel
| ServerInputModel
| undefined
isComposerActive = false
composerOpts: ComposerOpts | undefined
@ -93,7 +105,8 @@ export class ShellUiModel {
| ConfirmModel
| SharePostModel
| EditProfileModel
| CreateSceneModel,
| CreateSceneModel
| ServerInputModel,
) {
this.isModalActive = true
this.activeModal = modal