Add build flags and disable tabs for now

This commit is contained in:
Paul Frazee 2022-11-20 12:00:40 -06:00
parent 63348807b5
commit a21bcf10dd
7 changed files with 35 additions and 18 deletions

View file

@ -5,7 +5,6 @@ import {RootStoreModel} from './models/root-store'
import * as libapi from './lib/api'
import * as storage from './lib/storage'
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://bsky.social'

View file

@ -1,5 +1,5 @@
import {makeAutoObservable} from 'mobx'
import {isObj, hasProp} from '../lib/type-guards'
import {TABS_ENABLED} from '../../build-flags'
let __id = 0
function genId() {
@ -226,6 +226,9 @@ export class NavigationModel {
// =
newTab(url: string, title?: string) {
if (!TABS_ENABLED) {
return this.navigate(url)
}
const tab = new NavigationTabModel()
tab.navigate(url, title)
tab.isNewTab = true
@ -234,10 +237,16 @@ export class NavigationModel {
}
setActiveTab(tabIndex: number) {
if (!TABS_ENABLED) {
return
}
this.tabIndex = Math.max(Math.min(tabIndex, this.tabs.length - 1), 0)
}
closeTab(tabIndex: number) {
if (!TABS_ENABLED) {
return
}
this.tabs = [
...this.tabs.slice(0, tabIndex),
...this.tabs.slice(tabIndex + 1),