Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/metanomial/ctznry into me…
Browse files Browse the repository at this point in the history
…tanomial-master
  • Loading branch information
pfrazee committed Mar 9, 2021
2 parents 9d70ee6 + cbd10b6 commit 29527b7
Show file tree
Hide file tree
Showing 23 changed files with 128 additions and 7 deletions.
1 change: 1 addition & 0 deletions static/account.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
<link rel="stylesheet" href="/css/fontawesome.css">
<link rel="stylesheet" href="/css/tailwind.css">
<link rel="icon" href="/img/favicon.png">
<link rel="manifest" href="/manifest.json">
</head>
<body class="bg-white sm:bg-gray-50">
<ctzn-account></ctzn-account>
Expand Down
1 change: 1 addition & 0 deletions static/comment.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
<link rel="stylesheet" href="/css/fontawesome.css">
<link rel="stylesheet" href="/css/tailwind.css">
<link rel="icon" href="/img/favicon.png">
<link rel="manifest" href="/manifest.json">
</head>
<body class="bg-gray-50">
<ctzn-post-page></ctzn-post-page>
Expand Down
1 change: 1 addition & 0 deletions static/communities.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
<link rel="stylesheet" href="/css/fontawesome.css">
<link rel="stylesheet" href="/css/tailwind.css">
<link rel="icon" href="/img/favicon.png">
<link rel="manifest" href="/manifest.json">
</head>
<body class="bg-gray-50">
<ctzn-communities></ctzn-communities>
Expand Down
1 change: 1 addition & 0 deletions static/forgot-password.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
<link rel="stylesheet" href="/css/fontawesome.css">
<link rel="stylesheet" href="/css/tailwind.css">
<link rel="icon" href="/img/favicon.png">
<link rel="manifest" href="/manifest.json">
</head>
<body class="bg-white sm:bg-gray-50">
<ctzn-forgot-password></ctzn-forgot-password>
Expand Down
Binary file added static/img/icon-144.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added static/img/icon-192.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added static/img/icon-512.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 2 additions & 0 deletions static/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
<link rel="stylesheet" href="/css/fontawesome.css">
<link rel="stylesheet" href="/css/tailwind.css">
<link rel="icon" href="/img/favicon.png">
<link rel="manifest" href="/manifest.json">
<link rel="manifest" href="/manifest.json">
</head>
<body class="bg-gray-50">
<ctzn-app></ctzn-app>
Expand Down
1 change: 1 addition & 0 deletions static/js/account.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import * as history from './lib/history.js'
import * as toast from './com/toast.js'
import './com/header.js'
import './com/button.js'
import './com/register-service-worker.js'

class CtznAccount extends LitElement {
static get properties () {
Expand Down
7 changes: 7 additions & 0 deletions static/js/com/register-service-worker.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
if ('serviceWorker' in navigator) {
window.addEventListener('load', () =>
navigator.serviceWorker
.register('/service-worker.js')
.catch(console.error)
)
}
1 change: 1 addition & 0 deletions static/js/communities.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import { getProfile, listMemberships } from './lib/getters.js'
import * as displayNames from './lib/display-names.js'
import * as history from './lib/history.js'
import './com/header.js'
import './com/register-service-worker.js'

const SUGGESTED_COMMUNITIES = [
{
Expand Down
1 change: 1 addition & 0 deletions static/js/forgot-password.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import * as history from './lib/history.js'
import * as toast from './com/toast.js'
import './com/header.js'
import './com/button.js'
import './com/register-service-worker.js'

class CtznForgotPassword extends LitElement {
static get properties () {
Expand Down
5 changes: 3 additions & 2 deletions static/js/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import './com/login.js'
import './com/feed.js'
import './com/mobile-compose-btn.js'
import './com/img-fallbacks.js'
import './com/register-service-worker.js'

const SUGGESTED_COMMUNITIES = [
{
Expand Down Expand Up @@ -118,7 +119,7 @@ class CtznApp extends LitElement {
if (this.querySelector('ctzn-feed')) {
this.querySelector('ctzn-feed').load()
}

if ((new URL(window.location)).searchParams.has('composer')) {
await this.requestUpdate()
document.querySelector('ctzn-composer').focus()
Expand Down Expand Up @@ -373,4 +374,4 @@ class CtznApp extends LitElement {
}
}

customElements.define('ctzn-app', CtznApp)
customElements.define('ctzn-app', CtznApp)
1 change: 1 addition & 0 deletions static/js/notifications.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import * as history from './lib/history.js'
import './com/header.js'
import './com/notifications-feed.js'
import './com/img-fallbacks.js'
import './com/register-service-worker.js'

class CtznNotifications extends LitElement {
static get properties () {
Expand Down
1 change: 1 addition & 0 deletions static/js/post.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import './com/header.js'
import './com/button.js'
import './com/thread.js'
import './com/user-list.js'
import './com/register-service-worker.js'

class CtznPostPage extends LitElement {
static get properties () {
Expand Down
1 change: 1 addition & 0 deletions static/js/signup.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import { HTTP_ENDPOINT } from './lib/const.js'
import * as history from './lib/history.js'
import './com/header.js'
import './com/button.js'
import './com/register-service-worker.js'

const CANVAS_SIZE = 200
const SERVERS = ['ctzn.one']
Expand Down
11 changes: 6 additions & 5 deletions static/js/user.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import './com/feed.js'
import './com/mobile-compose-btn.js'
import './com/simple-user-list.js'
import './com/members-list.js'
import './com/register-service-worker.js'

class CtznUser extends LitElement {
static get properties () {
Expand Down Expand Up @@ -186,7 +187,7 @@ class CtznUser extends LitElement {
${mobileOnly ? 'block sm:hidden' : ''}
${id === this.currentView ? 'border-b-2 border-blue-600 text-blue-600' : ''}
`.replace('\n', '')

return html`
<ctzn-header
@post-created=${e => this.load()}
Expand Down Expand Up @@ -384,7 +385,7 @@ class CtznUser extends LitElement {
<div class="border border-gray-200 border-t-0 border-b-0 bg-white">
<ctzn-simple-user-list .ids=${this.following?.map(f => f.value.subject.userId)} empty-message="${this.userProfile.value.displayName} is not following anybody."></ctzn-simple-user-list>
</div>
`
`
} else if (this.currentView === 'communities') {
return html`
<div class="border border-t-0 border-gray-200 px-4 py-2 bg-white">
Expand Down Expand Up @@ -415,7 +416,7 @@ class CtznUser extends LitElement {
</div>
`}
</div>
`
`
} else if (this.currentView === 'members') {
return html`
<div class="border border-gray-200 border-t-0 border-b-0 bg-white">
Expand All @@ -425,7 +426,7 @@ class CtznUser extends LitElement {
@ban=${this.onBan}
></ctzn-members-list>
</div>
`
`
} else if (this.currentView === 'about') {
const renderRole = (roleId, permissions) => {
let members = this.getMembersWithRole(roleId)
Expand Down Expand Up @@ -492,7 +493,7 @@ class CtznUser extends LitElement {
<ctzn-button btn-class="text-sm px-4 py-1 ml-1 rounded-3xl" label="Manage Banned Users" @click=${this.onClickManageBans}></ctzn-button>
</div>
` : ''}
`
`
}
return html`
<div>
Expand Down
30 changes: 30 additions & 0 deletions static/manifest.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
{
"short_name": "CTZN",
"name": "CTZN",
"icons": [
{
"src": "/img/favicon.png",
"sizes": "32x32",
"type": "image/png"
},
{
"src": "/img/icon-144.png",
"sizes": "144x144",
"type": "image/png"
},
{
"src": "/img/icon-192.png",
"sizes": "192x192",
"type": "image/png"
},
{
"src": "/img/icon-512.png",
"sizes": "512x512",
"type": "image/png"
}
],
"start_url": "index.html",
"background_color": "#f9fafb",
"theme_color": "#ffffff",
"display": "standalone"
}
1 change: 1 addition & 0 deletions static/notifications.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
<link rel="stylesheet" href="/css/fontawesome.css">
<link rel="stylesheet" href="/css/tailwind.css">
<link rel="icon" href="/img/favicon.png">
<link rel="manifest" href="/manifest.json">
</head>
<body class="bg-gray-50">
<ctzn-notifications></ctzn-notifications>
Expand Down
1 change: 1 addition & 0 deletions static/post.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
<link rel="stylesheet" href="/css/fontawesome.css">
<link rel="stylesheet" href="/css/tailwind.css">
<link rel="icon" href="/img/favicon.png">
<link rel="manifest" href="/manifest.json">
</head>
<body class="bg-gray-50">
<ctzn-post-page></ctzn-post-page>
Expand Down
66 changes: 66 additions & 0 deletions static/service-worker.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
const CACHE_NAME = 'ctznry-0'
const CACHE_LIST = [
'/',
'/account',
'/communities',
'/forgot-password',
'/manifest.json',
'/notifications',
'/search',
'/signup',
'/css/common.css',
'/css/fontawesome.css',
'/css/tailwind.css',
'/img/default-user-thumb.jpg',
'/img/favicon.png',
'/img/img-placeholder.png',
'/img/spinner.gif',
'/js/main.build.js',
'/js/signup.build.js',
'/js/user.build.js',
'/js/post.build.js',
'/js/notifications.build.js',
'/js/communities.build.js',
'/js/account.build.js',
'/js/forgot-password.build.js',
'/webfonts/fa-brands-400.woff2',
'/webfonts/fa-regular-400.woff2',
'/webfonts/fa-solid-900.woff2'
]

async function install () {
const cache = await caches.open(CACHE_NAME)
cache.addAll(CACHE_LIST)
}

async function activate () {

// Delete old caches
const keyList = await caches.keys()
const cacheDeletions = keyList
.filter(key => key != CACHE_NAME)
.map(key => caches.delete(key))
await Promise.all(cacheDeletions)
}

async function cacheFetch (event) {

// Attempt response from cache
const cachedResponse = await caches.match(event.request)
if (cachedResponse) return cachedResponse

// Fetch over network
return fetch(event.request)
}

self.addEventListener('install', event => {
event.waitUntil(install())
})

self.addEventListener('activate', event => {
event.waitUntil(activate())
})

self.addEventListener('fetch', event => {
event.respondWith(cacheFetch(event))
})
1 change: 1 addition & 0 deletions static/signup.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
<link rel="stylesheet" href="/css/fontawesome.css">
<link rel="stylesheet" href="/css/tailwind.css">
<link rel="icon" href="/img/favicon.png">
<link rel="manifest" href="/manifest.json">
</head>
<body>
<ctzn-signup></ctzn-signup>
Expand Down
1 change: 1 addition & 0 deletions static/user.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
<link rel="stylesheet" href="/css/fontawesome.css">
<link rel="stylesheet" href="/css/tailwind.css">
<link rel="icon" href="/img/favicon.png">
<link rel="manifest" href="/manifest.json">
</head>
<body class="bg-gray-50">
<ctzn-user></ctzn-user>
Expand Down

0 comments on commit 29527b7

Please sign in to comment.