Import Nova assets from Sakura

This commit is contained in:
flash 2018-01-03 03:02:55 +01:00
parent 0ff25b62ed
commit 886de03762
24 changed files with 778 additions and 8 deletions

27
.gitignore vendored
View file

@ -1 +1,26 @@
vendor/ # Libraries
/vendor
/node_modules
/npm-debug.log
/yarn-error.log
# Configuration
/config/config.ini
# Storage
/store/*
!/store/.gitkeep
# OS specific
[Tt]humbs.db
[Dd]esktop.ini
# IDE specific
.vscode/
.vs/
.idea/
# Compiled/copied assets
/public/js
/public/css
/assets/typescript/*.d.ts

View file

@ -0,0 +1,24 @@
* {
margin: 0;
position: relative;
box-sizing: border-box;
}
html,
body {
height: 100%;
font: @base-font-size "Exo 2", sans-serif;
}
.fa {
font-family: inherit;
&:before {
font-family: FontAwesome;
}
}
// .turbolinks-progress-bar {
// height: 5px;
// background-color: green;
// }

View file

@ -0,0 +1,10 @@
.auth {
&__avatar {
height: 100px;
width: 100px;
background: no-repeat center center / cover @grey-f;
border-radius: 100%;
box-shadow: 0 @global-shadow-distance @global-shadow-size fade(@grey-1, @global-shadow-opacity);
margin: 6px auto 10px;
}
}

View file

@ -0,0 +1,25 @@
.banner {
height: 150px;
margin-top: @general-spacing;
background: no-repeat center center / cover @grey-2;
box-shadow: 0 @global-shadow-distance @global-shadow-size fade(@grey-1, @global-shadow-opacity);
display: flex;
flex-flow: column-reverse;
&--large {
height: 250px;
}
&--insane {
height: 400px;
}
&__bottom {
height: 60px;
background: fade(@grey-0, 80%);
display: inline-flex;
flex-flow: row;
align-items: center;
line-height: 1;
}
}

View file

@ -0,0 +1,21 @@
.button {
color: @grey-f;
text-decoration: none;
border: 0;
border-radius: 2px;
font-size: 1.5em;
font-family: inherit;
width: 100%;
background: darken(@purple, 20%);
padding: @general-spacing;
margin-bottom: 8px;
box-shadow: 0 8px 2px darken(@purple, 22%);
cursor: pointer;
transition: margin-bottom .2s, margin-top .2s, box-shadow .2s;
&:active {
margin-bottom: 2px;
margin-top: 6px;
box-shadow: 0 2px 2px darken(@purple, 22%);
}
}

View file

@ -0,0 +1,35 @@
.container {
min-height: 100%;
color: @grey-f;
background: url(@grid) @purple;
// no-repeat center center / cover
text-align: center;
&__wrapper {
margin: 0 auto;
padding: @general-spacing;
max-width: @container-max-width;
padding-bottom: 59px; // oddly specific number but it works
}
&__footer {
position: absolute;
bottom: 0;
left: 0;
right: 0;
font-size: .7em;
height: 60px;
padding-top: 20px;
background: linear-gradient(0deg, fade(@grey-0, 60%) 70%, fade(@grey-0, 70%) 80%, fade(@grey-0, 40%) 80%, transparent 90%) transparent;
&-link {
color: inherit;
text-decoration: none;
margin: 0 @general-spacing;
&:hover {
text-decoration: underline;
}
}
}
}

View file

@ -0,0 +1,52 @@
.form {
&__text {
background: fade(@grey-0, 50%);
border: 0;
border-radius: 2px;
font-size: 1.5em;
margin-bottom: @general-spacing;
box-shadow: inset 0 @global-shadow-distance @global-inner-shadow-size fade(@grey-0, @global-shadow-opacity);
padding: @general-spacing;
color: @grey-f;
font-family: inherit;
width: 100%;
}
&__status {
background: @grey-3;
margin: -@general-spacing;
margin-bottom: @general-spacing;
height: 40px;
display: flex;
align-items: center;
&-icon {
width: 40px;
height: 40px;
background: fade(@grey-0, 50%);
font-family: FontAwesome;
display: inline-flex;
align-items: center;
justify-content: center;
&:before {
content: "\f054";
}
}
&-text {
flex-grow: 1;
text-align: left;
padding: 0 (@general-spacing * 4);
font-size: .8em;
}
&--fail {
background: @red;
.form__status-icon:before {
content: "\f071";
}
}
}
}

View file

@ -0,0 +1,47 @@
.header {
width: 100%;
background: @grey-2;
box-shadow: 0 @global-shadow-distance @global-shadow-size fade(@grey-1, @global-shadow-opacity);
height: @header-height;
line-height: @header-height - 6px;
font-size: @header-font-size;
text-shadow: 0 @text-shadow-distance @text-shadow-size fade(@grey-0, @text-shadow-opacity);
padding: 2px;
&__inner {
max-width: @container-max-width;
margin: 0 auto;
display: flex;
justify-content: space-between;
}
&__entry {
padding-left: 12px;
text-decoration: none;
color: inherit;
&:before {
font-family: FontAwesome;
padding-right: 5px;
}
}
&__user {
display: inline-flex;
text-decoration: none;
color: inherit;
}
&__username {
padding: 0 15px;
}
&__avatar {
height: 46px;
width: 46px;
background: no-repeat center center / cover @grey-f;
border-radius: 1px;
box-shadow: 0 @global-shadow-distance @global-shadow-size fade(@grey-1, @global-shadow-opacity);
}
}

View file

@ -0,0 +1,44 @@
.landing {
text-shadow: 0 @text-shadow-distance @text-shadow-size fade(@grey-0, @text-shadow-opacity);
&__banner,
&__inner {
display: flex;
flex-flow: row-reverse;
}
&__text {
max-width: 300px;
}
&__buttons {
max-width: 200px;
display: inline-flex;
flex-flow: column;
justify-content: center;
}
&__inner,
&__buttons {
background: fade(@grey-0, 80%);
align-items: center;
height: 100%;
}
&__text,
&__button {
padding: 0 (@general-spacing * 4);
}
&__button {
color: inherit;
text-decoration: none;
cursor: pointer;
flex-grow: 1;
display: inline-flex;
align-items: center;
justify-content: center;
font-size: 2em;
width: 100%;
}
}

View file

@ -0,0 +1,11 @@
.platform {
margin: @platform-margin;
background: no-repeat center center / cover @grey-2;
box-shadow: 0 @global-shadow-distance @global-shadow-size fade(@grey-1, @global-shadow-opacity);
padding: @general-spacing;
&--thin {
margin: @platform-thin-margin;
display: inline-block;
}
}

View file

@ -0,0 +1,130 @@
.profile {
text-shadow: 0 @text-shadow-distance @text-shadow-size fade(@grey-0, @text-shadow-opacity);
&__header {
padding-left: @avatar-big + (@general-spacing * 4);
padding-right: @general-spacing * 2;
}
&__names {
flex-grow: 1;
text-align: left;
font-weight: 200;
}
&__username {
font-size: @font-size--profile-username;
}
&__title {
font-size: @font-size--profile-title;
}
&__dates {
font-weight: 300;
text-align: right;
font-size: @font-size--profile-dates;
line-height: 1.3em;
}
&__content {
display: flex;
flex-flow: row;
margin: 0 (@general-spacing * 2);
}
&__container {
flex-grow: 1;
&--left {
max-width: @avatar-big;
margin-right: @general-spacing;
top: -(@avatar-big - (@general-spacing * 2));
}
}
&__platform {
text-align: left;
margin: @general-spacing auto 0;
&:empty {
display: none;
}
}
&__avatar {
height: @avatar-big;
width: @avatar-big;
background: no-repeat center center / cover @grey-f;
border-radius: 1px;
box-shadow: 0 @global-shadow-distance @global-shadow-size fade(@grey-1, @global-shadow-opacity);
}
&__hierarchies {
font-size: 1.8em;
font-style: italic;
font-weight: 200;
}
&__hierarchy {
display: inline-flex;
align-items: center;
&-icon {
font-family: FontAwesome;
font-style: normal;
padding-right: 5px;
color: @grey-f;
text-align: center;
width: 1.2em;
}
&--founder {
color: #6c3082;
}
&--staff {
color: #fa3703;
}
&--developer {
color: #6eac0a;
}
&--contributor {
color: #ff69b4;
}
&--premium {
color: #ee9400;
}
&--banned {
color: #888;
}
}
&__accounts {
font-size: .9em;
}
&__account {
display: flex;
line-height: 1.3em;
color: inherit;
text-decoration: none;
&-text {
text-align: right;
flex-grow: 1;
font-style: italic;
font-weight: 200;
color: inherit;
}
&-icon {
text-align: center;
font-family: FontAwesome;
}
}
}

View file

@ -0,0 +1,140 @@
.status {
&__overall {
font-size: @font-size--status-overall;
font-weight: 100;
flex-grow: 1;
flex-shrink: 0;
text-align: left;
margin-left: @general-spacing * 4;
&-icon {
font-family: FontAwesome;
}
&-text {
font-style: italic;
}
&--good {
.status__overall-icon:before {
content: "\f05d";
}
}
}
&__last-update {
align-self: flex-end;
margin: @general-spacing * 2;
font-size: @font-size--status-last-update;
}
&__response {
display: flex;
}
&__services {
display: flex;
flex-flow: column;
border-right: 1px solid @grey-1;
}
&__service {
display: inline-flex;
padding: @general-spacing;
align-items: center;
line-height: 1;
&-icon {
width: 40px;
height: 20px;
border-radius: 4px;
transform: skewX(-10deg);
background: #333;
margin-left: @general-spacing / 2;
box-shadow: 0 @global-shadow-distance @global-shadow-size fade(@grey-1, @global-shadow-opacity);
}
&-name {
font-size: 24px;
text-align: right;
flex-grow: 1;
padding-left: @general-spacing * 10;
}
&--selected {
background: @grey-1;
}
&--good {
.status__service-icon {
background: @green;
}
}
&--bad {
.status__service-icon {
background: @red;
}
}
}
&__incident {
display: flex;
&:not(:last-child) {
border-bottom: 1px solid @grey-1;
margin-bottom: @general-spacing;
padding-bottom: @general-spacing;
}
&-date {
border-right: 1px solid @grey-1;
margin-right: @general-spacing;
padding: @general-spacing;
padding-left: 0;
font-size: @font-size--status-incident-date;
font-style: italic;
font-weight: 300;
min-width: 150px;
}
}
&__update {
display: flex;
&:not(:last-child) {
margin-bottom: @general-spacing;
}
&-meta {
text-align: left;
font-style: italic;
border-right: 1px solid @grey-1;
padding: @general-spacing;
margin-right: @general-spacing;
min-width: 150px;
}
&-text {
padding: @general-spacing;
}
&--good {
.status__update-meta {
border-color: @green;
}
}
&--busy {
.status__update-meta {
border-color: @orange;
}
}
&--bad {
.status__update-meta {
border-color: @red;
}
}
}
}

View file

@ -0,0 +1,24 @@
@purple: #5e3e71;
@red: #b01116;
@green: #007c36;
@orange: #cf7618;
@grey-0: #000;
@grey-1: #111;
@grey-2: #222;
@grey-3: #333;
@grey-4: #444;
@grey-5: #555;
@grey-6: #666;
@grey-7: #777;
@grey-8: #888;
@grey-9: #999;
@grey-a: #aaa;
@grey-b: #bbb;
@grey-c: #ccc;
@grey-d: #ddd;
@grey-e: #eee;
@grey-f: #fff;

View file

@ -0,0 +1,15 @@
@import "base";
@import "bem/auth";
@import "bem/banner";
@import "bem/button";
@import "bem/container";
@import "bem/form";
@import "bem/header";
@import "bem/landing";
@import "bem/platform";
@import "bem/profile";
@import "bem/status";
@import "colours";
@import "variables";

View file

@ -0,0 +1,30 @@
@grid: "https://static.flash.moe/images/grid.png";
@container-max-width: 1366px;
@general-spacing: 4px;
@platform-margin: @general-spacing (@general-spacing * 2) 0;
@platform-thin-margin: @general-spacing auto 0;
@avatar-big: 200px;
@global-shadow-opacity: 80%;
@global-shadow-size: 5px;
@global-inner-shadow-size: 2px;
@global-shadow-distance: 1px;
@text-shadow-opacity: 80%;
@text-shadow-size: 1px;
@text-shadow-distance: 1px;
@base-font-size: 16px;
@header-font-size: 1.5em;
@header-height: 50px;
@font-size--status-overall: 36px;
@font-size--status-last-update: 12px;
@font-size--status-incident-date: 24px;
@font-size--profile-username: 24px;
@font-size--profile-title: 14px;
@font-size--profile-dates: 12px;

View file

@ -0,0 +1 @@

83
build.sh Normal file
View file

@ -0,0 +1,83 @@
#!/bin/sh
ASSETS_PATH='./assets'
ASSETS_LESS="$ASSETS_PATH/less"
ASSETS_TS="$ASSETS_PATH/typescript"
LESS_ENTRY_FILE='main.less'
PUBLIC_DIR='./public'
PUBLIC_CSS="$PUBLIC_DIR/css"
PUBLIC_JS="$PUBLIC_DIR/js"
NODE_PATH='./node_modules'
NODE_DEST_JS="$PUBLIC_JS/libs.js"
NODE_IMPORT_JS=(
#'turbolinks/dist/turbolinks.js'
#'highlightjs/highlight.pack.min.js'
)
NODE_DEST_CSS="$PUBLIC_CSS/libs.css"
NODE_IMPORT_CSS=(
#'highlightjs/styles/default.css'
)
# delete old files, using find to avoid errors
echo "=> Cleanup"
find $ASSETS_TS -type f -name "*.d.ts" -delete -print
find $PUBLIC_CSS -type f -name "*.css" -delete -print
find $PUBLIC_JS -type f -name "*.js" -delete -print
echo
# styles
echo
echo "=> LESS"
for STYLE_DIR in $ASSETS_LESS/*/; do
STYLE_NAME=`basename $STYLE_DIR | tr '[A-Z]' '[a-z]'`
echo "==> $STYLE_NAME"
lessc --verbose $STYLE_DIR/$LESS_ENTRY_FILE $PUBLIC_CSS/$STYLE_NAME.css
echo
done
# scripts
echo
echo "=> TypeScript"
for SCRIPT_DIR in $ASSETS_TS/*/; do
SCRIPT_NAME=`basename $SCRIPT_DIR`
SCRIPT_NAME_LOWER=`echo $SCRIPT_NAME | tr '[A-Z]' '[a-z]'`
echo "==> $SCRIPT_NAME"
find $SCRIPT_DIR -name "*.ts" | xargs tsc \
-d \
-t es5 \
--listFiles \
--listEmittedFiles \
--noImplicitAny \
--removeComments \
--outFile $PUBLIC_JS/$SCRIPT_NAME_LOWER.js
mv -v $PUBLIC_JS/$SCRIPT_NAME_LOWER.d.ts $ASSETS_TS/$SCRIPT_NAME.d.ts
echo
done
# node imports
echo
echo "=> NPM imports"
echo "==> JavaScript"
echo "Creating $NODE_DEST_JS"
touch $NODE_DEST_JS
for FILE in "${NODE_IMPORT_JS[@]}"; do
echo "===> $FILE"
cat "$NODE_PATH/$FILE" >> $NODE_DEST_JS
done
echo
echo "==> CSS"
echo "Creating $NODE_DEST_CSS"
touch $NODE_DEST_CSS
for FILE in "${NODE_IMPORT_CSS[@]}"; do
echo "===> $FILE"
cat "$NODE_PATH/$FILE" >> $NODE_DEST_CSS
done

View file

@ -0,0 +1 @@

1
database/.gitkeep Normal file
View file

@ -0,0 +1 @@

View file

@ -66,19 +66,19 @@ class Application
$this->addModule('templating', new TemplateEngine); $this->addModule('templating', new TemplateEngine);
$this->addModule('config', new ConfigManager($config)); $this->addModule('config', new ConfigManager($config));
$this->debug(true);
$this->templating->addFilter('json_decode'); $this->templating->addFilter('json_decode');
$this->templating->addFilter('byte_symbol'); $this->templating->addFilter('byte_symbol');
$this->templating->addFunction('byte_symbol'); $this->templating->addFunction('byte_symbol');
$this->templating->addFunction('session_id'); $this->templating->addFunction('session_id');
$this->templating->addFunction('config', [$this->config, 'get']); $this->templating->addFunction('config', [$this->config, 'get']);
$this->templating->addFunction('route', [$this->router, 'url']); $this->templating->addFunction('route', [$this->router, 'url']);
$this->templating->addFunction('git_hash', [Application::class, 'gitCommitHash']);
$this->templating->addFunction('git_branch', [Application::class, 'gitBranch']);
$this->templating->addPath('nova', __DIR__ . '/../views/nova');
echo sprintf( echo $this->templating->render('home.landing');
'Running on commit <a href="https://github.com/flashwave/misuzu/commit/%s">%s</a> on branch <a href="https://github.com/flashwave/misuzu/tree/%3$s">%3$s</a>!',
self::gitCommitHash(true),
self::gitCommitHash(),
self::gitBranch()
);
} }
public function __destruct() public function __destruct()

View file

@ -122,7 +122,7 @@ class TemplateEngine
private function fixPath(string $path): string private function fixPath(string $path): string
{ {
// if the .twig extension if already present just assume that the path is already correct // if the .twig extension if already present just assume that the path is already correct
if (ends_width($path, self::FILE_EXTENSION)) { if (ends_with($path, self::FILE_EXTENSION)) {
return $path; return $path;
} }

1
store/.gitkeep Normal file
View file

@ -0,0 +1 @@

View file

@ -0,0 +1,5 @@
{% extends '@nova/master.twig' %}
{% block content %}
test
{% endblock %}

45
views/nova/master.twig Normal file
View file

@ -0,0 +1,45 @@
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
<title>Flashii</title>
<link href="https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css" rel="stylesheet" type="text/css">
<link href="https://fonts.googleapis.com/css?family=Exo+2:200,200italic,300,300italic,400,400italic" rel="stylesheet" type="text/css">
<link href="/css/libraries.css" rel="stylesheet" type="text/css" data-turbolinks-track>
<link href="/css/nova.css" rel="stylesheet" type="text/css" data-turbolinks-track>
</head>
<body>
<div class="container">
<nav class="header">
<div class="header__inner">
</div>
</nav>
<div class="container__wrapper {{ wrapper_classes|default('') }}">
<noscript>
<div class="banner" style="background-image: url('https://static.flash.moe/images/enable-javascript.png')"></div>
</noscript>
<div class="banner {{ banner_large is defined and banner_large ? 'banner--large' : '' }} {{ banner_classes|default('') }}" style="background-image: url('{{ banner|default('https://static.flash.moe/images/default-banner.png') }}')">
{{ block('banner_content') is defined ? block('banner_content') : '' }}
</div>
{{ block('content') is defined ? block('content') : '' }}
</div>
<div class="container__footer">
<div class="container__footer-copyright">
flash.moe 2013-{{ ''|date('Y') }} |
<a href="https://github.com/flashwave/misuzu/tree/{{ git_branch() }}" class="container__footer-link">{{ git_branch() }}</a>#<a href="https://github.com/flashwave/misuzu/commit/{{ git_hash(true) }}" class="container__footer-link">{{ git_hash() }}</a>
</div>
<div class="container__footer-links">
<a href="#" class="container__footer-link">Terms of Service</a>
<a href="#" class="container__footer-link">Rules</a>
<a href="#" class="container__footer-link">Contact</a>
<a href="#" class="container__footer-link">Status</a>
</div>
</div>
</div>
</body>
</html>