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.

107 lines
2.1 KiB

3 years ago
let p = console.log
2 years ago
import pkg from '../package.json'
let version = pkg.version
p "fuzzyhome version {version}"
3 years ago
2 years ago
# import sw from './sw.imba?serviceworker'
# navigator..serviceWorker..register(sw).then! do |reg| reg.update!
2 years ago
p "hehe"
2 years ago
import { nanoid } from 'nanoid'
import { err } from './utils'
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 './components/app-home'
import './components/app-community-links'
import './components/app-settings'
import './components/app-prompt'
import './components/app-edit'
import './components/app-links'
import './components/app-link'
import './components/app-bang'
import './components/app-tips'
2 years ago
import './styles'
extend tag element
get state
state
get api
api
get config
config
2 years ago
get refs
refs
get err
err
2 years ago
get version
version
get p
console.log
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
refs.links = $ah
unless global.localStorage.fuzzyhome_visited
await api.add_initial_links!
2 years ago
try
let default_bang = await api.add_link '!google search https://www.google.com/search?q='
config.data.default_bang = default_bang
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: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-home$ah>
3 years ago
imba.mount <app>