Compare commits

...

4 Commits

Author SHA1 Message Date
fe75120d69 peepe poopoo 2022-09-12 12:11:20 +02:00
44451dcc05 redesign 2022-07-11 11:44:38 +01:00
a5e9cf334e successfully added a http request 2022-05-27 21:40:48 +01:00
d41142e99d fixed warning in console 2022-05-27 21:39:48 +01:00
17 changed files with 320 additions and 136 deletions

33
Dockerfile Normal file
View File

@ -0,0 +1,33 @@
FROM node:latest AS Build
RUN npm install haxe --global
RUN npm install lix --global --force
# RUN haxelib --global install hmm
# RUN haxelib --global run hmm setup
COPY ./app /app
WORKDIR /app
# RUN hmm install
RUN lix scope
RUN lix download
RUN lix use haxe stable
RUN lix install haxelib:hxnodejs
RUN lix install haxelib:haxe-loader
RUN lix install haxelib:react
RUN lix install haxelib:react-router-4
# RUN lix install --global hmm
RUN yarn install
WORKDIR /app/
EXPOSE 9000
ENV NODE_OPTIONS="--openssl-legacy-provider"
CMD ["yarn", "start"]
# CMD ["/bin/bash"]

4
app/.haxerc Normal file
View File

@ -0,0 +1,4 @@
{
"version": "4.2.5",
"resolveLibs": "scoped"
}

View File

@ -0,0 +1,3 @@
# @install: lix --silent download "haxelib:/haxe-loader#0.9.0" into haxe-loader/0.9.0/haxelib
-cp ${HAXE_LIBCACHE}/haxe-loader/0.9.0/haxelib/haxelib/
-D haxe-loader=0.9.0

View File

@ -0,0 +1,3 @@
# @install: lix --silent download "haxelib:/history#0.0.1" into history/0.0.1/haxelib
-cp ${HAXE_LIBCACHE}/history/0.0.1/haxelib/src
-D history=0.0.1

View File

@ -0,0 +1,3 @@
# @install: lix --silent download "haxelib:/html-entities#1.0.0" into html-entities/1.0.0/haxelib
-cp ${HAXE_LIBCACHE}/html-entities/1.0.0/haxelib/src
-D html-entities=1.0.0

View File

@ -0,0 +1,7 @@
# @install: lix --silent download "haxelib:/hxnodejs#12.1.0" into hxnodejs/12.1.0/haxelib
-cp ${HAXE_LIBCACHE}/hxnodejs/12.1.0/haxelib/src
-D hxnodejs=12.1.0
--macro allowPackage('sys')
# should behave like other target defines and not be defined in macro context
--macro define('nodejs')
--macro _internal.SuppressDeprecated.run()

View File

@ -0,0 +1,6 @@
# @install: lix --silent download "haxelib:/react-router-4#0.2.8" into react-router-4/0.2.8/haxelib
-lib history
-cp ${HAXE_LIBCACHE}/react-router-4/0.2.8/haxelib/src
-D react-router-4=0.2.8
--macro react.router.bundle.Bundle.addHook()

View File

@ -0,0 +1,4 @@
# @install: lix --silent download "haxelib:/react#1.12.0" into react/1.12.0/haxelib
-lib html-entities
-cp ${HAXE_LIBCACHE}/react/1.12.0/haxelib/src/lib
-D react=1.12.0

View File

@ -1,60 +1,72 @@
*{ *{
/* margin: 0; */ font-family: Helvetica, sans-serif;
/* padding: 0; */
} }
html, body{
html, body, #pagewrapper, #root{ margin: 0;
height: 100vh; padding: 0;
margin: 0 0 0 0; background-color: black;
padding: 0 0 0 0; color: white;
overflow: auto; min-height: 100vh;
}
.flex-column{
display: flex;
flex-direction: column;
}
.flex-row{
display: flex;
flex-direction: row;
}
#flex{
display: flex;
height:100%; height:100%;
width:100%;
} }
body { /* SET UP GRID */
font-family: 'Terminus', sans-serif; #pagewrapper{
background-color: #000; display:grid;
grid-template-columns: 1fr auto 1fr;
grid-template-rows: auto auto;
}
header{
grid-column: 2;
grid-row: 1;
}
nav{
grid-column: 1;
grid-row: 2;
}
main{
grid-column: 2;
grid-row: 2;
} }
/* Now do other shit */
h1 { nav{
/* margin: 10px; */ color: white;
font-size: 32pt;
font-weight: bold;
font-style: oblique;
text-align: right;
margin-right: 8pt;
margin: 0px 8px 0px 0px;
line-height: 30pt;
}
nav .active{
font-style: oblique;
}
nav a{
text-decoration: none;
color: white;
} }
main{ main{
display: block; background-color: #233;
/* margin-left: 100px; */ padding: 16px;
/* margin-right:100px; */ color: #eee;
background-color: #333; min-width: 40vw;
color: lime; max-width: 800px;
box-sizing: border-box;
padding: 10px;
width: 100%;
height:100%;
}
ul{
align-self: left;
} }
a, a:visited, a:hover { main h1{
/* text-decoration: none; */ margin: 0px;
color: inherit;
} }
a.selected, a.selected:visited{ main p{
color:red; margin-top: 0px;
}
.active
{
color: #444
} }

View File

@ -2,6 +2,7 @@ import com.Foo;
import com.Foo2; import com.Foo2;
import components.Header; import components.Header;
import components.HomeContent; import components.HomeContent;
import components.ProjectsContent;
import components.sidebar.Sidebar; import components.sidebar.Sidebar;
import react.ReactMacro.jsx; import react.ReactMacro.jsx;
import react.ReactComponent; import react.ReactComponent;
@ -10,6 +11,7 @@ import react.router.ReactRouter;
import react.router.Route.RouteRenderProps; import react.router.Route.RouteRenderProps;
import react.router.Route; import react.router.Route;
import react.router.Redirect; import react.router.Redirect;
import react.router.NavLink;
private typedef RootState = { private typedef RootState = {
@ -46,31 +48,38 @@ class Root extends react.ReactComponentOf<RootProps,RootState> {
override function render() { override function render() {
return jsx(' return jsx('
<div id="pagewrapper" class="flex-column"> <div id="pagewrapper">
<Header/> <Header/>
<!--Current path is ${props.location.pathname} and component is ${state.route}--> <!--Current path is ${props.location.pathname} and component is ${state.route}-->
<!--${renderContent()}--> <!--${renderContent()}-->
<div id="flex" class="flex-row"> <nav id="sidebar">
<$Sidebar/> <$NavLink to="/home" activeClassName="active">
<main> Home
<$Route exact="true" path="/"> </NavLink><br/>
<$Redirect to="/home" /> <$NavLink to="/news" activeClassName="active">
</$Route> News
<$Route path="/home"> </NavLink><br/>
<HomeContent/> <$NavLink to="/projects" activeClassName="active">
</$Route> Projects
<$Route path="/projects"> </NavLink><br/>
<h1>Projects</h1> <$NavLink to="/partners" activeClassName="active">
</$Route> Partners
<$Route path="/links"> </NavLink><br/>
<h1>Links</h1> <$NavLink to="/about" activeClassName="active">
</$Route> About
<$Route path="/gameservers"> </NavLink><br/>
<h1>Game Servers</h1> </nav>
<p></p> <main>
</$Route> <$Route exact="true" path="/">
</main> <$Redirect to="/home" />
</div> </$Route>
<$Route path="/home">
<HomeContent/>
</$Route>
<$Route path="/projects">
<ProjectsContent/>
</$Route>
</main>
</div> </div>
'); ');
} }

View File

@ -1,18 +1,6 @@
header { header{
box-sizing: border-box; font-size: 48pt;
/* width:fit-content; */ font-weight: 600;
width:100%; font-style: oblique;
/* margin: 10px; */ /* text-size-adjust: auto; */
padding: 10px;
background: #eee;
/* color: white; */
/* margin-left: auto;
margin-right: auto; */
} }
header nav a{
margin-right: 10px;
}
.logo{
font-size: 3vw;
width:fit-content;
}

View File

@ -12,25 +12,9 @@ class Header extends ReactComponent{
} }
override function render() { override function render() {
return jsx(' return jsx('
<header> <header>
<div className="logo"> DRIVEBY, OK?
DRIVEBY! </header>
</div>
<nav>
<$NavLink to="/home" activeClassName="selected">
>Home
</NavLink>
<$NavLink to="/links" activeClassName="selected">
>Links
</NavLink>
<$NavLink to="/projects" activeClassName="selected">
>Projects
</NavLink>
<$NavLink to="/gameservers" activeClassName="selected">
>Game Servers
</NavLink>
</nav>
</header>
'); ');
} }
} }

View File

@ -1,4 +1,5 @@
package components; package components;
import js.html.XMLHttpRequest;
import react.ReactMacro.jsx; import react.ReactMacro.jsx;
import react.ReactComponent; import react.ReactComponent;
import js.Browser; import js.Browser;
@ -7,38 +8,83 @@ import react.router.ReactRouter;
import react.router.Route.RouteRenderProps; import react.router.Route.RouteRenderProps;
import react.router.Route; import react.router.Route;
import components.blog.Overview; import components.blog.Overview;
import js.lib.Promise;
class HomeContent extends ReactComponent { class HomeContent extends ReactComponent {
public function new(){
super();
state = { response: ["LOADING"], loaded: false }
}
static var STYLES = require('./HomeContent.css'); static var STYLES = require('./HomeContent.css');
public function yeet(){ public function yeet(){
trace(state); trace(state);
} }
//function sendRequest( image : Dynamic ) {
function sendRequest() {
return new js.lib.Promise(
function( resolve : Dynamic -> Void, reject )
{
var request = new XMLHttpRequest();
request.responseType = js.html.XMLHttpRequestResponseType.JSON;
request.onreadystatechange = function () {
if (request.readyState == 4) {
switch (request.status) {
case 200:
setState( { response: request.response } );
trace(request.response);
case 204:
resolve(true);
default:
trace( "Wrong response status" );
reject( request.response);
}
}
}
// var data = new js.html.FormData();
// // If we had a real file, we could use `file.name` as third argument
// data.append(props.formFieldName != null ? props.formFieldName : "file", image);
request.open("GET", "https://baconipsum.com/api/?type=meat-and-filler");
// request.send(data);
request.send();
});
}
override public function render() { override public function render() {
//var _yeet = yayeet();
var lorem = ["LOADING"];
if(state.loaded){
if(state.response != null)
lorem = state.response;
}
else{
setState({
loaded: "false"
});
sendRequest();
}
return jsx(' return jsx('
<div> <div>
<$Route exact="true" path={["/home","/home/about"]}> <article>
<div> <h1>WELCOME TO DRIVEBY!</h1>
<h2>Welcome to DRIVEBY!</h2>
<p> <p>
DRIVEBY! is the home of my personal projects. This includes but is not limited to:<br/> DRIVEBY! is an entity that creates software and entertainment, but also serves as a community revolving around DRIVEBY!\'s founder Hion-V and his pals.
- Gamedev<br/>
- Software<br/>
- Music<br/>
- Art<br/>
DRIVEBY! is run and operated by Hion-V. I am comitted to bringing you best-in-class entertainment and software.<br/>
</p> </p>
</div> <p>
</$Route> ${lorem[0]}
<$Route exact="true" path={["/home","/home/news"]}> ${lorem[1]}
<div> ${lorem[2]}
<h2>News</h2> </p>
<$Overview/> </article>
</div>
</$Route>
</div> </div>
'); ');
} }

View File

@ -0,0 +1,95 @@
package components;
import js.html.XMLHttpRequest;
import react.ReactMacro.jsx;
import react.ReactComponent;
import js.Browser;
import Webpack.*;
import react.router.ReactRouter;
import react.router.Route.RouteRenderProps;
import react.router.Route;
import components.blog.Overview;
import js.lib.Promise;
class ProjectsContent extends ReactComponent {
public function new(){
super();
state = { response: ["LOADING"], loaded: false }
}
static var STYLES = require('./HomeContent.css');
public function yeet(){
trace(state);
}
//function sendRequest( image : Dynamic ) {
function sendRequest() {
return new js.lib.Promise(
function( resolve : Dynamic -> Void, reject )
{
var request = new XMLHttpRequest();
request.responseType = js.html.XMLHttpRequestResponseType.JSON;
request.onreadystatechange = function () {
if (request.readyState == 4) {
switch (request.status) {
case 200:
setState( { response: request.response } );
trace(request.response);
case 204:
resolve(true);
default:
trace( "Wrong response status" );
reject( request.response);
}
}
}
// var data = new js.html.FormData();
// // If we had a real file, we could use `file.name` as third argument
// data.append(props.formFieldName != null ? props.formFieldName : "file", image);
request.open("GET", "https://baconipsum.com/api/?type=meat-and-filler");
// request.send(data);
request.send();
});
}
override public function render() {
//var _yeet = yayeet();
var lorem = ["LOADING"];
if(state.loaded){
if(state.response != null)
lorem = state.response;
}
else{
setState({
loaded: "false"
});
sendRequest();
}
return jsx('
<div>
<article>
<h1>Projects</h1>
<h2>Project 1</h2>
<p>
${lorem[0]}
${lorem[1]}
${lorem[2]}
</p>
<h2>Project 2</h2>
<p>
${lorem[3]}
${lorem[4]}
${lorem[5]}
</p>
</article>
</div>
');
}
}

View File

@ -20,7 +20,7 @@ class Overview extends ReactComponent {
private static function printList(){ private static function printList(){
var result = []; var result = [];
for (item in items){ for (item in items){
result.push(jsx('<li>$item</li>')); result.push(jsx('<li key="$item">$item</li>'));
} }
return result; return result;
} }

View File

@ -1,13 +0,0 @@
#sidebar{
display: block;
padding: 10px;
//padding-left:10px;
width: 150px;
background-color: #888;
height:100%
}
#sidebar ul, #sidebar li{
padding: 0;
margin: 0;
list-style-type: none;
}

View File

@ -18,7 +18,7 @@ class Sidebar extends ReactComponent {
override public function render() { override public function render() {
return jsx(' return jsx('
<div id="sidebar"> <nav id="sidebar">
<$Route path={["/home"]} component={SBHome}> <$Route path={["/home"]} component={SBHome}>
</$Route> </$Route>
@ -34,7 +34,7 @@ class Sidebar extends ReactComponent {
CS:GO<br/> CS:GO<br/>
Source Arena<br/> Source Arena<br/>
</$Route> </$Route>
</div> </nav>
'); ');
} }
} }