This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<div class="loading"> | |
<span class="bar bar-1"></span> | |
<span class="bar bar-2"></span> | |
<span class="bar bar-3"></span> | |
<span class="bar bar-4"></span> | |
</div> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
section { | |
padding: 40px 0px; | |
background-color: #fff; | |
width: 100%; | |
} | |
.border-top { | |
background-color: #eee; | |
position: relative; | |
box-shadow: 0 2px 4px #ccc inset; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const functions = require('firebase-functions'); | |
const gcs = require('@google-cloud/storage')(); | |
const sharp = require('sharp') | |
const _ = require('lodash'); | |
const path = require('path'); | |
const os = require('os'); | |
exports.generateThumbnail = functions.storage.object('uploads/{imageId}').onChange(event => { | |
const object = event.data; // The Storage object. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import "@babel/polyfill"; | |
import Vue from "vue"; | |
import * as VueGoogleMaps from "vue2-google-maps"; | |
import VTooltip from "v-tooltip"; | |
import router from "@/router"; | |
import store from "@/store"; | |
import Search from "@/Search.vue"; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { PostPartialUpdateRequest, PostUpdateRequest, ExternalLink, Post } from "../gen/api"; | |
import { Component } from "react"; | |
import { apiCall, postApi, externalLinkApi } from "../Api"; | |
export type PostCreateUpdateRequest = Post; | |
function isPostUpdateRequest(request: PostCreateUpdateRequest): request is PostPartialUpdateRequest | PostUpdateRequest { | |
return (request as PostPartialUpdateRequest).id !== undefined; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"hosting": { | |
"site": "site-name", | |
"public": "dist", | |
"ignore": ["firebase.json", "**/.*", "**/node_modules/**"], | |
"rewrites": [ | |
{ | |
"source": "**", | |
"destination": "/index.html" | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build and Deploy | |
on: | |
push: | |
branches: | |
- master | |
jobs: | |
build: | |
name: Build | |
runs-on: ubuntu-latest | |
steps: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { withSessionSsr } from '@utils/session'; | |
export default function Admin() { | |
// Users will never see this unless they're logged in. | |
return <h1>Secure page</h1>; | |
} | |
export const getServerSideProps = withSessionSsr(async function ({ req, res }) { | |
const user = req.session.user; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { useState } from 'react'; | |
import useUser from '@utils/useUser'; | |
export default function Login() { | |
// here we just check if user is already logged in and redirect to admin | |
const { mutateUser } = useUser({ | |
redirectTo: '/admin', | |
redirectIfFound: true, | |
}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { useEffect } from 'react'; | |
import Router from 'next/router'; | |
import useSWR from 'swr'; | |
export default function useUser({ | |
redirectTo = false, | |
redirectIfFound = false, | |
} = {}) { | |
const { data: user, mutate: mutateUser } = useSWR('/api/user'); |