Commit 845925c9 authored by Elias Künstler's avatar Elias Künstler
Browse files

clean up

parent 76b0b665
#!/usr/bin/bash
debug=$1
rm -rf bundle
if [ "$debug" = 'debug' ]
then
meteor build --debug ./ --server-only --architecture os.linux.x86_64
else
meteor build ./ --server-only --architecture os.linux.x86_64
fi
tar xf *.tar.gz
mv bundle .bundle
workingdir=`pwd`
cd .bundle/programs/server
npm install
cd ../..
export MONGO_URL="mongodb://localhost:27017/"
export ROOT_URL="http://localhost:8080"
export PORT="8080"
function cleanup {
echo "\ncleaning up"
cd $workingdir
rm -rf .bundle
rm *.tar.gz
}
trap cleanup EXIT
echo "starting node"
node main.js
projectname=$1
sshaccess=$2
sshport=$3
echo "Did you update the version number in all of the following files?"
echo "ServiceWorker - sw.js"
echo "package.json"
echo "mobile-config.js"
read -p "Press Enter to continue"
meteor build ./ --server-only --architecture os.linux.x86_64
scp -P $sshport $projectname.tar.gz $sshaccess
:host {
/* SPACINGS */
--space-xs: 4px;
--space-sm: 8px;
--space-md: 16px;
--space-lg: 32px;
--space-xl: 64px;
--space-xxl: 128px;
/* COLORS */
--primary-action-color: darkgreen;
--seconday-action-color: white;
--secondary-action-color-complementary: black;
--primary-color: #1ad6ee;
--secondary-color: #00001a;
--text-color: #797986;
--dark-text-color: var(--secondary-color);
--mdc-theme-primary: var(--primary-action-color);
}
[href] { cursor: pointer; }
\ No newline at end of file
Subproject commit fe78662fe370029f7f425a3e393111485688b178
Subproject commit b16a2a5284b8b8df5c15e15a0882dd7cf511aa7f
Subproject commit 3ea19584b07e552075720765ac37317363db6980
Subproject commit 736b3624466e964cc795e9db56faa4b5f2a2a32a
Subproject commit 013195d19694e3a6e820c59bc32cf4feb496e0ba
Subproject commit 387481a7916a1ee6f9411ced323d4031ecfd8685
#outerWrapper #logo {
height: 100%;
min-height: 100%;
transition: height 0.3s;
}
#outerWrapper #logo[scrolled] {
height: 20%;
min-height: 20%;
justify-content: flex-start;
padding-left: var(--space-lg);
}
#menu {
border-bottom: 1px solid var(--secondary-color);
}
#menu::after {
content: '';
background: url('/logo.svg');
background-size: contain;
background-repeat: no-repeat;
background-position: right;
opacity: 0.02;
position: fixed;
height: 33vh;
width: 33vw;
right: var(--space-xl);
bottom: var(--space-xl);
pointer-events: none;
}
#menu div {
font-size: 1rem;
font-weight: normal;
color: var(--secondary-color);
background: transparent;
position: relative;
height: 48px;
text-transform: uppercase;
}
#menu div::before {
content: '';
position: absolute;
top: 0;
left: 0;
width: 100%;
display: flex;
align-items: center;
justify-content: center;
font-weight: bold;
height: 0%;
transition: height 0.3s;
color: transparent;
background: var(--secondary-color);
}
#menu div::after {
content: attr(title);
position: absolute;
top: 0;
left: 0;
width: 100%;
display: flex;
align-items: center;
justify-content: center;
font-weight: normal;
height: 100%;
color: var(--secondary-color);
transition: color 0.3s;
background: transparent;
}
#menu div[selected] {
font-weight: bold;
color: var(--primary-color);
}
#menu div[selected]::before {
height: 100%;
}
#menu div[selected]::after {
color: var(--primary-color);
font-weight: bold;
}
.content > * {
flex: none;
}
.content h1,
.content a-writer.h1 {
align-self: flex-start;
font-size: 1.3rem;
font-weight: bold;
color: var(--secondary-color);
text-transform: uppercase;
background: var(--primary-color);
position: relative;
height: 50px;
display: flex;
align-items: center;
justify-content: flex-end;
padding: 0 var(--space-lg);
transition: margin 0.3s;
min-width: 40vw;
text-align: right;
}
.content h1:not(:first-of-type),
.content a-writer.h1:not(:first-of-type) {
margin-top: var(--space-xl);
}
.content h1:hover,
.content a-writer.h1:hover {
margin-left: var(--space-lg);
}
.content h1::after,
.content a-writer.h1::after {
content: '';
position: absolute;
top: 0;
left: 100%;
border-bottom: 50px solid var(--primary-color);
border-right: 75px solid transparent;
}
.content h1::before,
.content a-writer.h1::before {
content: '';
position: absolute;
top: 0;
left: 0;
width: 0;
height: 100%;
background: var(--secondary-color);
border-right: 2px solid black;
transition: width 0.3s, left 0.3s;
}
.content h1:hover::before,
.content a-writer.h1:hover::before {
width: var(--space-lg);
left: calc(0px - var(--space-lg));
}
.content p,
.content a-writer {
align-self: center;
color: var(--dark-text-color);
max-width: 750px;
text-align: left;
font-weight: normal;
padding: var(--space-sm) var(--space-lg);
margin: 0 0 var(--space-md) 0;
}
[invisible] {
opacity: 0;
}
import { Base, html, element, prop, mongo } from 'imports/client/base';
import { innerHTML as styleString } from './main-element.scss';
import { AdornisLoader as AL } from 'imports/client/adornis-components/a-loader';
import '@material/mwc-button';
import '@material/mwc-icon';
import { AdornisRouter } from './adornis-components/a-router';
import { map, takeUntil, filter, debounceTime, auditTime, tap } from 'rxjs/operators';
import './adornis-components/a-writer';
import MeteorReactiveSubject from './base/reactives/meteor';
import { ContentKlazz, Content } from 'imports/db/contents';
import { MongoSubject } from './base/reactives/mongo';
import { repeat } from 'lit-html/directives/repeat';
import { Subject } from 'rxjs';
import { element, html, ScopingElement } from './base';
@element('main-element')
export class MainElement extends Base {
@prop(false)
private scrolled!: boolean;
@mongo()
private contents!: ContentKlazz[];
private userBehavior = new MeteorReactiveSubject(Meteor.user).pipe(map(user => !!user));
private saveDebouncer = new Subject<{ _id: string; content: ContentKlazz }>();
private changes: Array<{ _id: string; content: ContentKlazz }> = [];
constructor() {
super(styleString);
AdornisRouter.get(['/:page']);
Meteor.subscribe('contents');
(this.mongo('contents') as MongoSubject<ContentKlazz>).switchCursor(
Content.find({ category: AdornisRouter.get().page }),
);
AdornisRouter.get()
.reactiveStore.retrieve('page')
.pipe(takeUntil(this.disconnected))
.subscribe(page => {
this.log.log('page changed: ', AdornisRouter.get().page);
(this.mongo('contents') as MongoSubject<ContentKlazz>).switchCursor(
Content.find({ category: AdornisRouter.get().page }),
);
});
this.saveDebouncer
.pipe(
tap(saveObject => this.changes.push(saveObject)),
auditTime(1000),
)
.subscribe(() => {
const changes = [...this.changes];
this.changes = [];
this.log.log('update db: ', changes);
changes.forEach(saveObject =>
Content.update({ _id: saveObject._id }, { $set: { content: saveObject.content.content } }),
);
});
this.globals('network active').subscribe(active => this.log.log('network active: ', active));
this.mongo('contents').subscribe(contentChange => this.log.log('change: ', contentChange));
}
export class MainElement extends ScopingElement {
public renderWithStyles() {
this.log.log('contents', this.contents);
return html`
<div
id="outerWrapper"
vertical
style="width: 100vw; height: 100vh; background: #797986;"
oa-auto
@scroll="${(e: CustomEvent) => (this.scrolled = true)}"
>
<div
horizontal
center-center
ph-md
pv-lg
w100
id="logo"
?scrolled="${this.scrolled}"
style="background: #00001a;"
>
<img src="/logo.svg" href="/" style="height: 80%;" />
<div vertical center-justified ?hidden="${!this.scrolled}" pl-md>
<span style="color: #797986; width: 100px;" bold>BASE</span>
<span style="color: #797986; width: 100px;" bold>PROJECT</span>
</div>
<mwc-icon
?hidden="${this.scrolled}"
style="color: var(--text-color); position: fixed; bottom: var(--space-md); left: calc(50% - 2rem); font-size: 4rem;"
>expand_more</mwc-icon
>
</div>
<div flex vertical font-center bold ?invisible="${!this.scrolled}">
<div id="menu" flex-none horizontal w100 justified>
<div
ph-lg
pv-md
flex
href="/instructions"
title="Anleitung"
?selected="${AdornisRouter.get()
.reactiveStore.retrieve('page')
.pipe(map(() => AdornisRouter.get().page === 'instructions'))}"
></div>
<div
ph-lg
pv-md
flex
href="/base"
title="Base Modules"
?selected="${AdornisRouter.get()
.reactiveStore.retrieve('page')
.pipe(map(() => AdornisRouter.get().page === 'base'))}"
></div>
<div
ph-lg
pv-md
flex
href="/adornis"
title="Adornis Components"
?selected="${AdornisRouter.get()
.reactiveStore.retrieve('page')
.pipe(map(() => AdornisRouter.get().page === 'adornis'))}"
></div>
<div
ph-lg
pv-md
flex
href="/cms"
title="CMS Components"
?selected="${AdornisRouter.get()
.reactiveStore.retrieve('page')
.pipe(map(() => AdornisRouter.get().page === 'cms'))}"
></div>
<div
ph-lg
pv-md
flex
href="/mail"
title="Mail Components"
?selected="${AdornisRouter.get()
.reactiveStore.retrieve('page')
.pipe(map(() => AdornisRouter.get().page === 'mail'))}"
></div>
</div>
<div pt-xl pb-md oa-auto vertical class="content">
${repeat(
this.contents,
content => content._id,
content => {
this.log.log('content stuffs: ', content.content);
return html`
<a-writer
class="h1"
.string="${content.title}"
@string-changed="${(e: CustomEvent<{ value: string }>) => {
const contentUpdate = {
title: e.detail.value,
content: content.content,
category: content.category,
};
this.saveDebouncer.next({ _id: content._id, content: contentUpdate });
}}"
></a-writer>
<a-writer
.isAdmin="${this.userBehavior}"
.string="${content.content}"
@string-changed="${(e: CustomEvent<{ value: string }>) => {
this.log.log('string changed: ', e.detail.value, typeof e.detail.value === 'string');
if (typeof e.detail.value === 'string') {
const contentUpdate = {
title: content.title,
content: e.detail.value,
category: content.category,
};
this.saveDebouncer.next({ _id: content._id, content: contentUpdate });
}
}}"
></a-writer>
`;
},
)}
${this.userBehavior.pipe(
map(isUser =>
isUser
? html`
<button
@click="${() =>
new Content({
title: 'Neuer Paragraph',
content: 'Hier kommt dein Inhalt rein',
category: AdornisRouter.get().page,
}).save()}"
>
Add Paragraph
</button>
`
: '',
),
)}
</div>
</div>
</div>
Hello World
`;
}
}
import Logger from 'imports/adornis-log';
export abstract class MessageQueue {
protected logger: Logger;
constructor() {
this.logger = new Logger(this);
}
public abstract scheduleNow(message: Message, userIds?: string[]): void;
}
export class AdornisCommunication {
private channels: { [name: string]: Channel } = {};
private constructor() {}
private static storedInstance: AdornisCommunication;
public static get instance() {
if (!this.storedInstance) this.storedInstance = new AdornisCommunication();
return this.storedInstance;
}
public addChannel(name: string, ...messageQueues: MessageQueue[]) {
this.channels[name] = new Channel(name, messageQueues);
}
public sendMessage(channel: string, message: Message, userIds: string[] = []) {
this.channels[channel].sendMessage(message, userIds);
}
}
class Channel {
constructor(public name: string, private messageQueues: MessageQueue[]) {}
public sendMessage(message: Message, userIds: string[]) {
this.messageQueues.forEach(q => q.scheduleNow(message, userIds));
}
}
export class Recipient {
constructor(public to: string[], public cc?: string[], public bcc?: string[], public replyTo?: string) {}
}
export class Message {
constructor(public html: string, public subject: string) {}
}
import { MessageQueue, Message } from './';
import Logger from 'imports/adornis-log';
import { Adornisnotification, NotificationTypeEnum } from 'imports/db';
export class NotificationQueue extends MessageQueue {
constructor() {
super();
}
public scheduleNow(message: Message, userIDs?: string[]) {
const type = Object.keys(NotificationTypeEnum)[Math.floor(Math.random() * 3)];
new Adornisnotification({ userIDs, message, type }).save();
new Logger(this).log('sending notification', message);
}
}
import { Class, Enum } from 'meteor/jagi:astronomy';
export const contents = new Mongo.Collection('contents');
export const Category = Enum.create({
name: 'category',
identifiers: {
HOME: '',
INSTRUCTIONS: 'instructions',
BASE: 'base',
ADORNIS: 'adornis',
CMS: 'cms',
MAIL: 'mail',
},
});
export const Content = Class.create({
name: 'contents',
collection: contents,
fields: {
title: String,
content: String,
category: { type: Category, default: Category.HOME },
},
secured: false,
});
export declare class ContentKlazz {
public _id: string;
public title: string;
public content: string;
public category: string;
}
if (Meteor.isServer) {
Meteor.publish('contents', () => contents.find());
}
if (Meteor.isClient) window.Content = Content;
export * from './files';
export * from './contents';
export declare class ProductKlazz {
public _id?: string;
public name?: string;
public price?: number;
public description?: string;
public thumbnail?: string;
public rent?: boolean;
public logThis: (input: string) => void;
}
export declare class TournamentKlazz {
public _id?: string;
public tournamentId?: string;
public name?: string;
public shortName?: string;
public description?: string;
public cityCode?: CityEnum;
public starred?: boolean;
public ended?: boolean;
public ended_description?: string;
public ended_images?: string[];
}
export enum CityEnum {
DA = 'DA',
}
export * from './files';
\ No newline at end of file
Subproject commit 832641743751d6c6a07b545f54f138ff36d2af32
Subproject commit dfd17dd258fd6519bb1ddaf50c6bebf2b026798f