You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

98 lines
2.0 KiB

3 years ago
let p = console.log
2 years ago
# import sw from './sw.imba?serviceworker'
# navigator..serviceWorker..register(sw).then! do |reg| reg.update!
import download from 'downloadjs'
2 years ago
import { nanoid } from 'nanoid'
import { err } from './utils'
2 years ago
import pkg from '../package.json'
let version = pkg.version
p "fuzzyhome version {version}"
2 years ago
import db from './db'
import state from './state'
let refs = {}
import api from './api'
2 years ago
import config from './config'
2 years ago
import app-community-links from './components/app-community-links'
import app-settings from './components/app-settings'
import app-prompt from './components/app-prompt'
import app-edit from './components/app-edit'
import app-links from './components/app-links'
2 years ago
import app-link from './components/app-link'
import app-bang from './components/app-bang'
2 years ago
import './styles'
extend tag element
get state
state
get api
api
get config
config
get p
console.log
2 years ago
get refs
refs
get err
err
3 years ago
tag app
fatal_error = no
get render? do mounted?
3 years ago
def mount
2 years ago
refs.settings = $as
refs.edit = $ae
refs.community-links = $acl
unless global.localStorage.fuzzyhome_visited
await api.add_initial_links!
global.localStorage.fuzzyhome_visited = yes
try
await api.reload_db!
p "links:", state.links
catch e
2 years ago
err "state.loading database", e
fatal_error = yes
return
3 years ago
def render
<self.disabled=state.loading>
css d:flex fld:column jc:flex-start ai:center
w:80vw max-width:700px max-height:80vh
3 years ago
bxs:0px 0px 10px rgba(0,0,0,0.35)
box-sizing:border-box p:30px rd:10px mt:10vh
3 years ago
if fatal_error
<.fatal>
css c:blue2
"""
2 years ago
There was an error state.loading the database.
This could be due to a user setting
disallowing local storage, or a random error.
Consider refreshing.
Check developer console for more information.
"""
2 years ago
elif $acl.active
<app-community-links$acl>
2 years ago
elif $as.active
<app-settings$as>
2 years ago
elif $ae.active
<app-edit$ae>
2 years ago
else
<app-links>
3 years ago
imba.mount <app>