Base index page fleshed out but now requires polish

This commit is contained in:
shockrah 2021-10-05 15:52:08 -07:00
parent 6b8e7de31a
commit 7b86e738df
27 changed files with 418 additions and 0 deletions

View File

@ -0,0 +1,6 @@
---
title: "{{ replace .Name "-" " " | title }}"
date: {{ .Date }}
draft: true
---

7
frontend/config.toml Normal file
View File

@ -0,0 +1,7 @@
baseURL = 'https://clips.shockrah.xyz/'
languageCode = 'en-us'
title = "Shockrah's Clips"
theme = "clippable"

View File

@ -0,0 +1,5 @@
---
title: Shockrah's Clips
description: Clips I think are kinda kewl
image: /favicon.png
---

View File

@ -0,0 +1,10 @@
<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
<channel>
<title>Categories on Shockrah&#39;s Clips</title>
<link>https://clips.shockrah.xyz/categories/</link>
<description>Recent content in Categories on Shockrah&#39;s Clips</description>
<generator>Hugo -- gohugo.io</generator>
<language>en-us</language><atom:link href="https://clips.shockrah.xyz/categories/index.xml" rel="self" type="application/rss+xml" />
</channel>
</rss>

View File

@ -0,0 +1,42 @@
html, body, div, tag {
margin: 0;
padding: 0;
border: 0;
font-size: 100%;
vertical-align: baseline;
background: #212121;
text-align: center;
}
* {
box-sizing: border-box;
}
.content {
margin: 0 auto;
padding: 0 2em;
line-height: 1.6em;
color: whitesmoke;
}
.video-gallery {
display: flex;
flex-wrap: wrap;
justify-content: center;
}
.video-block {
padding: 1em;
width: 400px;
line-height: 1em;
margin-right: 1em;
margin-bottom: 1em;
background: #191818;
border-radius: 1em;
}
.pure-form {
text-align: center;
}
.pure-img {
border-radius: 0.5em;
}

BIN
frontend/public/favicon.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.4 KiB

View File

@ -0,0 +1,39 @@
<!DOCTYPE html>
<html lang="en"><head>
<meta name="generator" content="Hugo 0.88.1" />
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" type="text/css" href="/css/style.css">
<link rel="stylesheet" href="https://unpkg.com/purecss@1.0.0/build/pure-min.css" integrity="sha384-nn4HPE8lTHyVtfCBi5yW9d20FjT8BJwUXyWZT9InLYax14RDjBj46LmSztkmNP9w" crossorigin="anonymous">
<link rel="shortcut icon" type="image/png" href="/favicon.png"/>
<title>Shockrah&#39;s Clips</title>
<meta property="og:title" content="Shockrah&#39;s Clips">
<meta property="og:site_name" content="Shockrah's not-a-blog">
<meta property="og:url" content="https://clips.shockrah.xyz/">
<meta property="og:description" content="Clips I think are kinda kewl">
<meta property="og:type" content="website">
<meta property="og:image" content="/favicon.png">
</head>
<script src="/js/index.js"></script>
<body>
<div id="layout">
<div class="content">
<h1>Shockrah&#39;s Clips</h1>
<p>asdf</p>
</div>
</div>
</body>
</html>

10
frontend/public/index.xml Normal file
View File

@ -0,0 +1,10 @@
<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
<channel>
<title>Shockrah&#39;s Clips</title>
<link>https://clips.shockrah.xyz/</link>
<description>Recent content on Shockrah&#39;s Clips</description>
<generator>Hugo -- gohugo.io</generator>
<language>en-us</language><atom:link href="https://clips.shockrah.xyz/index.xml" rel="self" type="application/rss+xml" />
</channel>
</rss>

View File

@ -0,0 +1,11 @@
<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"
xmlns:xhtml="http://www.w3.org/1999/xhtml">
<url>
<loc>https://clips.shockrah.xyz/categories/</loc>
</url><url>
<loc>https://clips.shockrah.xyz/</loc>
</url><url>
<loc>https://clips.shockrah.xyz/tags/</loc>
</url>
</urlset>

View File

@ -0,0 +1,10 @@
<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
<channel>
<title>Tags on Shockrah&#39;s Clips</title>
<link>https://clips.shockrah.xyz/tags/</link>
<description>Recent content in Tags on Shockrah&#39;s Clips</description>
<generator>Hugo -- gohugo.io</generator>
<language>en-us</language><atom:link href="https://clips.shockrah.xyz/tags/index.xml" rel="self" type="application/rss+xml" />
</channel>
</rss>

BIN
frontend/static/favicon.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.4 KiB

View File

@ -0,0 +1,20 @@
The MIT License (MIT)
Copyright (c) 2021 YOUR_NAME_HERE
Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
the Software, and to permit persons to whom the Software is furnished to do so,
subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

View File

@ -0,0 +1,2 @@
+++
+++

View File

@ -0,0 +1,11 @@
<!DOCTYPE html>
<html>
{{- partial "head.html" . -}}
<body>
{{- partial "header.html" . -}}
<div id="content">
{{- block "main" . }}{{- end }}
</div>
{{- partial "footer.html" . -}}
</body>
</html>

View File

@ -0,0 +1,14 @@
<!DOCTYPE html>
<html lang="en">
{{- partial "head.html" . -}}
<script src="/js/index.js"></script>
<body>
<div id="layout">
<div class="content">
<h1>{{ .Title }}</h1>
<div class="video-gallery" id="main-container">
</div>
</div>
</div>
</body>
</html>

View File

@ -0,0 +1,32 @@
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" type="text/css" href="/css/style.css">
<link rel="stylesheet" href="https://unpkg.com/purecss@1.0.0/build/pure-min.css" integrity="sha384-nn4HPE8lTHyVtfCBi5yW9d20FjT8BJwUXyWZT9InLYax14RDjBj46LmSztkmNP9w" crossorigin="anonymous">
<link rel="shortcut icon" type="image/png" href="/favicon.png"/>
{{ $title := print .Title }}
{{ if .IsHome }}{{ $title = .Site.Title}}{{end}}
<title>{{ $title }}</title>
<meta property="og:title" content="{{ $title }}">
<meta property="og:site_name" content="Shockrah's not-a-blog">
{{ $url := .RelPermalink | absURL }}
<meta property="og:url" content="{{$url}}">
{{ $desc := print .Description }}
{{ if .IsHome }}{{ $desc = .Params.Description }}{{end}}
<meta property="og:description" content="{{ $desc }}">
<meta property="og:type" content="website">
{{ $ogvideo := "" }}
{{ if .Params.Video }}
{{ $ogvideo = .Params.Video }}
<meta property="og:video" content="{{ $ogvideo }}">
<meta property="og:video:width" content="640">
<meta property="og:video:height" content="480">
{{ else }}
{{ $ogimage := "/favicon.png" }}
{{ if .Params.Image }}
{{ $ogimage = .Params.Image }}
{{ end }}
<meta property="og:image" content="{{ $ogimage }}">
{{ end }}
</head>

View File

@ -0,0 +1,42 @@
html, body, div, tag {
margin: 0;
padding: 0;
border: 0;
font-size: 100%;
vertical-align: baseline;
background: #212121;
text-align: center;
}
* {
box-sizing: border-box;
}
.content {
margin: 0 auto;
padding: 0 2em;
line-height: 1.6em;
color: whitesmoke;
}
.video-gallery {
display: flex;
flex-wrap: wrap;
justify-content: center;
}
.video-block {
padding: 1em;
width: 400px;
line-height: 1em;
margin-right: 1em;
margin-bottom: 1em;
background: #191818;
border-radius: 1em;
}
.pure-form {
text-align: center;
}
.pure-img {
border-radius: 0.5em;
}

View File

@ -0,0 +1,42 @@
"use strict";
class Category {
constructor(raw) {
this.name = raw['name'];
this.thumbnail_b64 = raw['thumbnail'];
}
as_div_str() {
let container = document.createElement('div');
container.className = 'video-block';
let title = document.createElement('h2');
title.innerText = this.name;
let nail = document.createElement('img');
nail.className = 'pure-img';
if (!(this.thumbnail_b64 == null || this.thumbnail_b64.length == 0)) {
nail.setAttribute('src', `data:image/jpg;base64,${this.thumbnail_b64}`);
}
container.appendChild(title);
container.appendChild(nail);
document.getElementById('main-container').appendChild(container);
return container;
}
}
function ready_handler(e) {
// Only let this make a get request once we're ready on the page
if (document.readyState != 'complete') {
return e;
}
// All we do here is basically make a get request to /api/categories
const endpoint = 'http://localhost/api/categories';
let xml = new XMLHttpRequest();
xml.open('GET', endpoint, false); // sync request
xml.send(null); // nothing required for stuff
if (xml.getResponseHeader('Content-Type') == 'application/json') {
let raw = JSON.parse(xml.responseText);
for (const cat_raw of raw['categories']) {
let cat = new Category(cat_raw);
cat.as_div_str();
}
}
return e;
}
document.addEventListener('readystatechange', ready_handler);

View File

@ -0,0 +1,21 @@
# theme.toml template for a Hugo theme
# See https://github.com/gohugoio/hugoThemes#themetoml for an example
name = "Clippable"
license = "MIT"
licenselink = "https://github.com/yourname/yourtheme/blob/master/LICENSE"
description = ""
homepage = "http://example.com/"
tags = []
features = []
min_version = "0.41.0"
[author]
name = ""
homepage = ""
# If porting an existing theme
[original]
name = ""
homepage = ""
repo = ""

51
frontend/ts/index.ts Normal file
View File

@ -0,0 +1,51 @@
class Category {
name: string
thumbnail_b64: string|null
constructor(raw: any) {
this.name = raw['name']
this.thumbnail_b64 = raw['thumbnail']
}
public as_div_str() {
let container = document.createElement('div')
container.className = 'video-block'
let title = document.createElement('h2')
title.innerText = this.name
let nail = document.createElement('img')
nail.className = 'pure-img'
if(!(this.thumbnail_b64 == null || this.thumbnail_b64.length == 0)) {
nail.setAttribute('src', `data:image/jpg;base64,${this.thumbnail_b64}`)
}
container.appendChild(title)
container.appendChild(nail)
document.getElementById('main-container').appendChild(container)
return container
}
}
function ready_handler(e?: Event) : Event {
// Only let this make a get request once we're ready on the page
if(document.readyState != 'complete') { return e }
// All we do here is basically make a get request to /api/categories
const endpoint = 'http://localhost/api/categories'
let xml = new XMLHttpRequest()
xml.open('GET', endpoint, false) // sync request
xml.send(null) // nothing required for stuff
if(xml.getResponseHeader('Content-Type') == 'application/json') {
let raw = JSON.parse(xml.responseText)
for(const cat_raw of raw['categories']) {
let cat = new Category(cat_raw)
cat.as_div_str()
}
}
return e
}
document.addEventListener('readystatechange', ready_handler)

16
frontend/ts/package.json Normal file
View File

@ -0,0 +1,16 @@
{
"name": "ts",
"version": "1.0.0",
"description": "Frontend scripts built out for clippable's frontend",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"build": "tsc"
},
"repository": {
"type": "git",
"url": "gitlab.com/shockrah/clippable.git"
},
"author": "shockrah",
"license": "GPL-3.0"
}

27
frontend/ts/tsconfig.json Normal file
View File

@ -0,0 +1,27 @@
{
"compilerOptions": {
"target": "es6",
"module": "commonjs",
"outDir": "../themes/clippable/static/js/",
"importHelpers": true,
/* Strict Type-Checking Options */
"strict": true,
"strictNullChecks": false,
"strictFunctionTypes": true,
"noImplicitThis": true,
"alwaysStrict": true,
/* Additional Checks */
"noUnusedLocals": true,
"noUnusedParameters": true,
"noImplicitReturns": true,
"noFallthroughCasesInSwitch": true,
/*"noUncheckedIndexedAccess": true, */
/*"noPropertyAccessFromIndexSignature": true, */
/* Module Resolution Options */
"esModuleInterop": true,
"skipLibCheck": true,
"forceConsistentCasingInFileNames": true,
}
}