Compare commits

..

1 Commits

Author SHA1 Message Date
Thomas Hintz 29e4955de5 wip 5 years ago

@ -21,6 +21,5 @@
"@babel/preset-react" "@babel/preset-react"
], ],
"plugins": [["@babel/plugin-proposal-decorators", { "legacy": true }], "plugins": [["@babel/plugin-proposal-decorators", { "legacy": true }],
"@babel/plugin-proposal-class-properties", "@babel/plugin-proposal-class-properties"]
"emotion"]
} }

@ -1,5 +0,0 @@
/node_modules/
/node_modules_bak/
/dist/
*~
/src/server/farm

@ -1,58 +0,0 @@
FROM alpine as chicken
ENV CHICKEN_VERSION 4.11.0
ENV PLATFORM linux
RUN set -eux; \
apk update; \
apk --no-cache --update add build-base; \
wget -qO- https://code.call-cc.org/releases/${CHICKEN_VERSION}/chicken-${CHICKEN_VERSION}.tar.gz | tar xzv; \
cd /chicken-${CHICKEN_VERSION}; \
make PLATFORM=${PLATFORM}; \
make PLATFORM=${PLATFORM} install; \
make PLATFORM=${PLATFORM} check; \
cd /; \
rm -rf /chicken-${CHICKEN_VERSION}
FROM chicken as deps
RUN chicken-install http-session srfi-69 coops uri-common srfi-18 medea numbers spiffy spiffy-cookies sql-de-lite crypt intarweb sxml-transforms websockets miscmacros
FROM deps as deps2
RUN chicken-install -r pll; \
cd pll; \
sed -i '1s/^/(import scheme)\n/' amb.scm; \
chicken-install
FROM deps2 as compat
RUN apk --no-cache --update add libc6-compat
FROM node:16 as node
WORKDIR /farm
# COPY ./ /farm
COPY package.json package.json
COPY package-lock.json package-lock.json
RUN npm install
FROM node as buildfe
WORKDIR /farm
COPY ./ /farm
RUN make prodfe
FROM compat as buildfarm
WORKDIR /farm
COPY ./ /farm
RUN make farm
FROM buildfarm as farm
WORKDIR /farm
RUN mkdir dist
COPY --from=buildfe /farm/dist /farm/dist
RUN cp src/server/farm dist/; \
chmod +x dist/farm
FROM farm as run
WORKDIR /farm/dist
ENTRYPOINT ["./farm"]
CMD ["-:a50"]
# CMD ./farm

@ -17,38 +17,25 @@
# along with the Alpha Centauri Farming project. If not, see # along with the Alpha Centauri Farming project. If not, see
# <https://www.gnu.org/licenses/>. # <https://www.gnu.org/licenses/>.
.PHONY: clean install interactive cypress .PHONY: clean install interactive
assets := assets/game/acf/ assets := assets/game/acf/
docker:
sudo docker build --network=host . -t farm
dev: dev:
npx webpack --config webpack.dev.js --env.assets ./$(assets) npx webpack --config webpack.dev.js --env.assets ./$(assets)
rundev: rundev:
webpack-dev-server --open --config webpack.dev.js --env.assets ./$(assets)
# make interactive
rundevserver:
make interactive make interactive
prod: src/server/farm prod: src/server/farm
npx webpack --config webpack.prod.js --env.assets ./$(assets) npx webpack --config webpack.prod.js --env.assets ./$(assets)
prodfe:
npx webpack --config webpack.prod.js --env.assets ./$(assets)
install: install:
npm init -y npm init -y
npm install npm install
interactive: interactive:
csi -include-path $(assets) -include-path src/server -s src/server/farm.scm cd dist/ && csi -include-path $(assets) -include-path ../src/server -s farm.scm
interactiveserver:
cd dist ; csi -include-path $(assets) -include-path ../src/server -s farm.scm
src/server/farm: src/server/farm.scm src/server/db.scm src/server/farm: src/server/farm.scm src/server/db.scm
cd src/server/ && csc -include-path ../../$(assets) -O3 farm.scm cd src/server/ && csc -include-path ../../$(assets) -O3 farm.scm
@ -62,9 +49,6 @@ runprod:
upload: upload:
rsync -rtvz dist/ $(SERVER):~/farm rsync -rtvz dist/ $(SERVER):~/farm
cypress:
npm run cypress:open
clean: clean:
rm -f *~ res/js/app.js rm -f *~ res/js/app.js

Binary file not shown.

@ -1,94 +0,0 @@
Copyright (c) 2012, Pablo Impallari (www.impallari.com|impallari@gmail.com),
Copyright (c) 2012, Rodrigo Fuenzalida (www.rfuenzalida.com|hello<6C>rfuenzalida.com), with Reserved Font Name Libre Baskerville.
This Font Software is licensed under the SIL Open Font License, Version 1.1.
This license is copied below, and is also available with a FAQ at:
http://scripts.sil.org/OFL
-----------------------------------------------------------
SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007
-----------------------------------------------------------
PREAMBLE
The goals of the Open Font License (OFL) are to stimulate worldwide
development of collaborative font projects, to support the font creation
efforts of academic and linguistic communities, and to provide a free and
open framework in which fonts may be shared and improved in partnership
with others.
The OFL allows the licensed fonts to be used, studied, modified and
redistributed freely as long as they are not sold by themselves. The
fonts, including any derivative works, can be bundled, embedded,
redistributed and/or sold with any software provided that any reserved
names are not used by derivative works. The fonts and derivatives,
however, cannot be released under any other type of license. The
requirement for fonts to remain under this license does not apply
to any document created using the fonts or their derivatives.
DEFINITIONS
"Font Software" refers to the set of files released by the Copyright
Holder(s) under this license and clearly marked as such. This may
include source files, build scripts and documentation.
"Reserved Font Name" refers to any names specified as such after the
copyright statement(s).
"Original Version" refers to the collection of Font Software components as
distributed by the Copyright Holder(s).
"Modified Version" refers to any derivative made by adding to, deleting,
or substituting -- in part or in whole -- any of the components of the
Original Version, by changing formats or by porting the Font Software to a
new environment.
"Author" refers to any designer, engineer, programmer, technical
writer or other person who contributed to the Font Software.
PERMISSION & CONDITIONS
Permission is hereby granted, free of charge, to any person obtaining
a copy of the Font Software, to use, study, copy, merge, embed, modify,
redistribute, and sell modified and unmodified copies of the Font
Software, subject to the following conditions:
1) Neither the Font Software nor any of its individual components,
in Original or Modified Versions, may be sold by itself.
2) Original or Modified Versions of the Font Software may be bundled,
redistributed and/or sold with any software, provided that each copy
contains the above copyright notice and this license. These can be
included either as stand-alone text files, human-readable headers or
in the appropriate machine-readable metadata fields within text or
binary files as long as those fields can be easily viewed by the user.
3) No Modified Version of the Font Software may use the Reserved Font
Name(s) unless explicit written permission is granted by the corresponding
Copyright Holder. This restriction only applies to the primary font name as
presented to the users.
4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font
Software shall not be used to promote, endorse or advertise any
Modified Version, except to acknowledge the contribution(s) of the
Copyright Holder(s) and the Author(s) or with their explicit written
permission.
5) The Font Software, modified or unmodified, in part or in whole,
must be distributed entirely under this license, and must not be
distributed under any other license. The requirement for fonts to
remain under this license does not apply to any document created
using the Font Software.
TERMINATION
This license becomes null and void if any of the above conditions are
not met.
DISCLAIMER
THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE
COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM
OTHER DEALINGS IN THE FONT SOFTWARE.

@ -1,93 +0,0 @@
Copyright (c) 2010, Kimberly Geswein (kimberlygeswein.com)
This Font Software is licensed under the SIL Open Font License, Version 1.1.
This license is copied below, and is also available with a FAQ at:
http://scripts.sil.org/OFL
-----------------------------------------------------------
SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007
-----------------------------------------------------------
PREAMBLE
The goals of the Open Font License (OFL) are to stimulate worldwide
development of collaborative font projects, to support the font creation
efforts of academic and linguistic communities, and to provide a free and
open framework in which fonts may be shared and improved in partnership
with others.
The OFL allows the licensed fonts to be used, studied, modified and
redistributed freely as long as they are not sold by themselves. The
fonts, including any derivative works, can be bundled, embedded,
redistributed and/or sold with any software provided that any reserved
names are not used by derivative works. The fonts and derivatives,
however, cannot be released under any other type of license. The
requirement for fonts to remain under this license does not apply
to any document created using the fonts or their derivatives.
DEFINITIONS
"Font Software" refers to the set of files released by the Copyright
Holder(s) under this license and clearly marked as such. This may
include source files, build scripts and documentation.
"Reserved Font Name" refers to any names specified as such after the
copyright statement(s).
"Original Version" refers to the collection of Font Software components as
distributed by the Copyright Holder(s).
"Modified Version" refers to any derivative made by adding to, deleting,
or substituting -- in part or in whole -- any of the components of the
Original Version, by changing formats or by porting the Font Software to a
new environment.
"Author" refers to any designer, engineer, programmer, technical
writer or other person who contributed to the Font Software.
PERMISSION & CONDITIONS
Permission is hereby granted, free of charge, to any person obtaining
a copy of the Font Software, to use, study, copy, merge, embed, modify,
redistribute, and sell modified and unmodified copies of the Font
Software, subject to the following conditions:
1) Neither the Font Software nor any of its individual components,
in Original or Modified Versions, may be sold by itself.
2) Original or Modified Versions of the Font Software may be bundled,
redistributed and/or sold with any software, provided that each copy
contains the above copyright notice and this license. These can be
included either as stand-alone text files, human-readable headers or
in the appropriate machine-readable metadata fields within text or
binary files as long as those fields can be easily viewed by the user.
3) No Modified Version of the Font Software may use the Reserved Font
Name(s) unless explicit written permission is granted by the corresponding
Copyright Holder. This restriction only applies to the primary font name as
presented to the users.
4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font
Software shall not be used to promote, endorse or advertise any
Modified Version, except to acknowledge the contribution(s) of the
Copyright Holder(s) and the Author(s) or with their explicit written
permission.
5) The Font Software, modified or unmodified, in part or in whole,
must be distributed entirely under this license, and must not be
distributed under any other license. The requirement for fonts to
remain under this license does not apply to any document created
using the Font Software.
TERMINATION
This license becomes null and void if any of the above conditions are
not met.
DISCLAIMER
THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE
COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM
OTHER DEALINGS IN THE FONT SOFTWARE.

Binary file not shown.

Before

Width:  |  Height:  |  Size: 74 KiB

@ -1,3 +0,0 @@
{
"baseUrl": "http://localhost:8080"
}

@ -1,5 +0,0 @@
{
"name": "Using fixtures to represent data",
"email": "hello@cypress.io",
"body": "Fixtures are a great way to mock data for responses to routes"
}

@ -1,25 +0,0 @@
describe('My First Test', () => {
it('Visits the Kitchen Sink', () => {
cy.visit('/')
cy.contains('Begin').click()
cy.contains('New Game').click()
cy.contains('Login').click()
cy.get('form [name="username"]').type('test')
cy.get('form [name="password"]').type('food')
cy.get('button[type="submit"]').click()
cy.get('form [name="gameName"]').type('test')
cy.get('button[type="submit"]').click()
cy.get('span[class="add-ai"]').click()
cy.contains('Ready to start').click()
cy.contains('Start Game').click()
cy.get('.show .action-item').first().click()
})
})

@ -1,21 +0,0 @@
/// <reference types="cypress" />
// ***********************************************************
// This example plugins/index.js can be used to load plugins
//
// You can change the location of this file or turn off loading
// the plugins file with the 'pluginsFile' configuration option.
//
// You can read more here:
// https://on.cypress.io/plugins-guide
// ***********************************************************
// This function is called when a project is opened or re-opened (e.g. due to
// the project's config changing)
/**
* @type {Cypress.PluginConfig}
*/
module.exports = (on, config) => {
// `on` is used to hook into various events Cypress emits
// `config` is the resolved Cypress config
}

@ -1,25 +0,0 @@
// ***********************************************
// This example commands.js shows you how to
// create various custom commands and overwrite
// existing commands.
//
// For more comprehensive examples of custom
// commands please read more here:
// https://on.cypress.io/custom-commands
// ***********************************************
//
//
// -- This is a parent command --
// Cypress.Commands.add("login", (email, password) => { ... })
//
//
// -- This is a child command --
// Cypress.Commands.add("drag", { prevSubject: 'element'}, (subject, options) => { ... })
//
//
// -- This is a dual command --
// Cypress.Commands.add("dismiss", { prevSubject: 'optional'}, (subject, options) => { ... })
//
//
// -- This will overwrite an existing command --
// Cypress.Commands.overwrite("visit", (originalFn, url, options) => { ... })

@ -1,20 +0,0 @@
// ***********************************************************
// This example support/index.js is processed and
// loaded automatically before your test files.
//
// This is a great place to put global configuration and
// behavior that modifies Cypress.
//
// You can change the location of this file or turn off
// automatically serving support files with the
// 'supportFile' configuration option.
//
// You can read more here:
// https://on.cypress.io/configuration
// ***********************************************************
// Import commands.js using ES2015 syntax:
import './commands'
// Alternatively you can use CommonJS syntax:
// require('./commands')

22698
package-lock.json generated

File diff suppressed because it is too large Load Diff

@ -2,8 +2,6 @@
"name": "farm", "name": "farm",
"sideEffects": [ "sideEffects": [
"*.css", "*.css",
"*.scss",
"*.ttf",
"*.woff", "*.woff",
"*.woff2" "*.woff2"
], ],
@ -13,8 +11,7 @@
"scripts": { "scripts": {
"test": "echo \"Error: no test specified\" && exit 1", "test": "echo \"Error: no test specified\" && exit 1",
"build": "webpack --config webpack.dev.js", "build": "webpack --config webpack.dev.js",
"prod": "webpack --config webpack.prod.js", "prod": "webpack --config webpack.prod.js"
"cypress:open": "cypress open"
}, },
"keywords": [], "keywords": [],
"author": "", "author": "",
@ -25,39 +22,36 @@
"@babel/plugin-proposal-decorators": "^7.8.3", "@babel/plugin-proposal-decorators": "^7.8.3",
"@babel/preset-env": "^7.8.3", "@babel/preset-env": "^7.8.3",
"@babel/preset-react": "^7.8.3", "@babel/preset-react": "^7.8.3",
"@pmmmwh/react-refresh-webpack-plugin": "^0.4.1",
"autoprefixer": "^9.7.4", "autoprefixer": "^9.7.4",
"babel-loader": "^8.0.6", "babel-loader": "^8.0.6",
"babel-plugin-transform-decorators-legacy": "^1.3.5", "babel-plugin-transform-decorators-legacy": "^1.3.5",
"clean-webpack-plugin": "^3.0.0", "clean-webpack-plugin": "^3.0.0",
"copy-webpack-plugin": "^5.1.1", "copy-webpack-plugin": "^5.1.1",
"css-loader": "^3.4.2", "css-loader": "^3.4.2",
"css-url-relative-plugin": "^1.0.0", "favicons-webpack-plugin": "^2.1.0",
"cypress": "^4.4.1",
"file-loader": "^4.3.0", "file-loader": "^4.3.0",
"html-webpack-plugin": "^3.2.0", "html-webpack-plugin": "^3.2.0",
"mini-css-extract-plugin": "^0.8.2", "mini-css-extract-plugin": "^0.8.2",
"node-sass": "^4.13.1",
"optimize-css-assets-webpack-plugin": "^5.0.3", "optimize-css-assets-webpack-plugin": "^5.0.3",
"postcss-loader": "^3.0.0", "postcss-loader": "^3.0.0",
"react-refresh": "^0.8.3",
"sass-loader": "^8.0.2", "sass-loader": "^8.0.2",
"style-loader": "^1.1.3", "style-loader": "^1.1.3",
"terser-webpack-plugin": "^2.3.5",
"webpack": "^4.41.5", "webpack": "^4.41.5",
"webpack-cli": "^3.3.10", "webpack-cli": "^3.3.10",
"webpack-dev-server": "^3.11.0",
"webpack-merge": "^4.2.2" "webpack-merge": "^4.2.2"
}, },
"dependencies": { "dependencies": {
"@emotion/core": "^10.0.35",
"@fortawesome/fontawesome-svg-core": "^1.2.26", "@fortawesome/fontawesome-svg-core": "^1.2.26",
"@fortawesome/free-solid-svg-icons": "^5.12.0", "@fortawesome/free-solid-svg-icons": "^5.12.0",
"@fortawesome/react-fontawesome": "^0.1.8", "@fortawesome/react-fontawesome": "^0.1.8",
"cookies-js": "^1.2.3", "cookies-js": "^1.2.3",
"css-url-relative-plugin": "^1.0.0",
"mobx": "^5.15.3",
"mobx-react": "^6.1.4",
"react": "^16.12.0", "react": "^16.12.0",
"react-dom": "^16.12.0", "react-dom": "^16.12.0",
"react-redux": "^7.1.3", "react-redux": "^7.1.3",
"redux": "^4.0.5", "redux": "^4.0.5"
"sass": "^1.69.5"
} }
} }

@ -28,62 +28,67 @@ import Welcome from '../welcome/Welcome.jsx'
import Tractor from '../tractor/Tractor.jsx' import Tractor from '../tractor/Tractor.jsx'
import { SCREENS, messagePanelId } from '../../constants.js' import { SCREENS, messagePanelId } from '../../constants.js'
import { play } from './actions.js'
const Chrome = ({ children, spikes, tractorClass }) => { class Chrome extends React.Component {
return ( render() {
<div className='flex-fullcenter'> return (
<div className='background-heading'><h1>Alpha Centauri Farming</h1></div> <div className='flex-fullcenter'>
{children} <div className='background-heading'><h1>Alpha Centauri Farming</h1></div>
<Tractor spikes={spikes} className={tractorClass} /> {this.props.children}
</div> <Tractor spikes={this.props.spikes} className={this.props.tractorClass} />
); </div>
);
}
} }
const App = ({ screen, logout, createAccount, login, errors }) => { class App extends React.Component {
let view; render() {
switch (screen) { let view;
switch (this.props.screen) {
case SCREENS.intro: case SCREENS.intro:
view = (<Chrome spikes={true} tractorClass='intro'><Welcome /></Chrome>); view = (<Chrome spikes={true} tractorClass='intro'><Welcome /></Chrome>);
break; break;
case SCREENS.start: case SCREENS.start:
view = (<Chrome><CreateOrJoin signOut={logout} /></Chrome>); view = (<Chrome><CreateOrJoin signOut={this.props.logout} /></Chrome>);
break; break;
case SCREENS.newGame: case SCREENS.newGame:
view = (<Chrome> view = (<Chrome>
<div className='view-container'>
<NewGame colors={['green', 'red', 'blue', 'yellow', 'black']}
button={'Start'}
title={'New Game'}
type={'new-game'}
showGameName={true}
createAccount={createAccount}
login={login}
errors={errors}
/>
</div>
</Chrome>);
break;
case SCREENS.joinGame:
view = (
<Chrome>
<div className='view-container'> <div className='view-container'>
<JoinGame createAccount={createAccount} <NewGame colors={['green', 'red', 'blue', 'yellow', 'black']}
login={login} button={'Start'}
errors={errors} title={'New Game'}
type={'new-game'}
showGameName={true}
createAccount={this.props.createAccount}
login={this.props.login}
errors={this.props.errors}
/> />
</div> </div>
</Chrome>); </Chrome>);
break;
case SCREENS.joinGame:
view = (
<Chrome>
<div className='view-container'>
<JoinGame createAccount={this.props.createAccount}
login={this.props.login}
errors={this.props.errors}
/>
</div>
</Chrome>);
break; break;
case SCREENS.play: case SCREENS.play:
view = (<Board />); view = (<Board />);
break; break;
}
return (
<Fragment>
{view}
<div id={messagePanelId}><MessagePanel /></div>
</Fragment>
);
} }
return (
<Fragment>
{view}
<div id={messagePanelId}><MessagePanel /></div>
</Fragment>
);
} }
export default connect( export default connect(

@ -61,6 +61,14 @@ export default class CreateAccount extends React.Component {
</label> </label>
</Col> </Col>
</Row> </Row>
<Row>
<Col width="12">
<label>
Email (optional)
<input onChange={this.onChange} name="email" type="email" />
</label>
</Col>
</Row>
<Row> <Row>
<Col width="12"> <Col width="12">
<label> <label>

@ -24,31 +24,32 @@ import Cookies from 'cookies-js'
import { GroupBox, Row, Col, Button } from '../widgets.jsx' import { GroupBox, Row, Col, Button } from '../widgets.jsx'
import { showNewGame, showJoinGame } from '../app/actions.js' import { showNewGame, showJoinGame } from '../app/actions.js'
const CreateOrJoin = ({ signOut, showNewGame, start, showJoinGame }) => { class CreateOrJoin extends React.Component {
const handleSignOut = (e) => { signOut = (e) => {
e.preventDefault(); e.preventDefault();
signOut(); this.props.signOut();
Cookies.expire('awful-cookie'); Cookies.expire('awful-cookie');
} }
return ( render() {
<Fragment> return (
<div className="font-preloader">text</div> <Fragment>
<Button size='large' className='shadow action-item' onClick={showNewGame}> <Button size='large' className='shadow' onClick={this.props.showNewGame}>
New Game New Game
</Button> </Button>
{(start.start.games.length > 0) || (start.start.openGames.length > 0) ? ( {(this.props.start.start.games.length > 0) || (this.props.start.start.openGames.length > 0) ? (
<Button size='large' className='shadow' onClick={showJoinGame}> <Button size='large' className='shadow' onClick={this.props.showJoinGame}>
Join Game Join Game
</Button> </Button>
) : (<Fragment />)} ) : (<Fragment />)}
{start.start.user ? ( {this.props.start.start.user ? (
<Button size='large' className='shadow sign-out-button' onClick={handleSignOut}> <Button size='large' className='shadow sign-out-button' onClick={this.signOut}>
Sign Out Sign Out
</Button> </Button>
) : (<></>)} ) : (<></>)}
</Fragment> </Fragment>
); );
}
} }
export default connect( export default connect(

File diff suppressed because it is too large Load Diff

@ -21,22 +21,26 @@ import { connect } from 'react-redux'
import SpaceNode from './SpaceNode.jsx' import SpaceNode from './SpaceNode.jsx'
const MessagePanel = (props) => { import { setMessagePanelSpace, mpMouse } from './actions.js'
if (props.space !== null) {
const panel = document.getElementById('message-panel'), class MessagePanel extends React.Component {
mpDims = props.mpDims; render () {
panel.style.top = if (this.props.space !== null) {
(Math.min(Math.max(mpDims.mouseY, mpDims.minHeight + mpDims.padding), const panel = document.getElementById('message-panel'),
mpDims.maxHeight)) + 'px'; mpDims = this.props.mpDims;
panel.style.left = panel.style.top =
(Math.min(Math.max(mpDims.mouseX, mpDims.minWidth + mpDims.padding), (Math.min(Math.max(mpDims.mouseY, mpDims.minHeight + mpDims.padding),
mpDims.maxWidth)) + 'px'; mpDims.maxHeight)) + 'px';
return ( panel.style.left =
<SpaceNode space={props.space} height='210px' (Math.min(Math.max(mpDims.mouseX, mpDims.minWidth + mpDims.padding),
showtitle={true} orientation={''} /> mpDims.maxWidth)) + 'px';
); return (
} else { <SpaceNode space={this.props.space} height='210px'
return null; showtitle={true} orientation={''} />
);
} else {
return null;
}
} }
} }

@ -22,9 +22,8 @@ export default class PlayerIcon extends React.Component {
render() { render() {
return ( return (
<center> <center>
{this.props.colors.map(c => ( {this.props.colors
<div key={c} className={'player player-' + c + (c === this.props.current ? ' player-current' : '')} /> .map(c => (<div key={c} className={'player player-' + c}></div>))}
))}
</center> </center>
); );
} }

@ -73,7 +73,7 @@ class SpaceNode extends React.Component {
{title} {title}
</div>) </div>)
: (null)} : (null)}
{ this.props.space.players.length ? <PlayerIcon colors={this.props.space.players} current={this.props.current} /> : ''} { this.props.space.players.length ? <PlayerIcon colors={this.props.space.players} /> : ''}
<div className='space-description'> <div className='space-description'>
{this.props.space.description} {this.props.space.description}
</div> </div>

@ -31,8 +31,7 @@ import { itemCard, fateCard } from 'game.js'
export { initialize, buy, roll, endTurn, loan, trade, submitTradeAccept, export { initialize, buy, roll, endTurn, loan, trade, submitTradeAccept,
submitTradeDeny, submitTradeCancel, audit, handleMessage, submitTradeDeny, submitTradeCancel, audit, handleMessage,
nextAction, buyUncleBert, actionsFinished, skip, endAiTurn, nextAction, buyUncleBert, actionsFinished, skip, endAiTurn,
startGame, readyToStart, leaveGame, kickPlayer, toggleRevealForTrade, startGame, readyToStart, leaveGame }
addAIPlayer, birthdayBonusPlayer }
let store; let store;
let movingTimer = 0; let movingTimer = 0;
@ -127,7 +126,7 @@ function handleMessage(evt) {
store.dispatch(autoSkip(data.component)); store.dispatch(autoSkip(data.component));
} }
if (data.event === 'end-of-game') { if (data.event === 'end-of-game') {
store.dispatch(alert(ALERTS.endOfGame, { results: data.results, stats: data.stats }, 'endOfGame' + data.game.turn)); store.dispatch(alert(ALERTS.endOfGame, data.results, 'endOfGame' + data.game.turn));
} }
}); });
}; };
@ -214,22 +213,6 @@ function leaveGame() {
sendCommand({ type: 'leave-game' }); sendCommand({ type: 'leave-game' });
} }
function kickPlayer(name) {
sendCommand({ type: 'kick-player', name });
}
function birthdayBonusPlayer(name) {
sendCommand({ type: 'birthday-bonus-player', name });
}
function addAIPlayer() {
sendCommand({ type: 'add-ai-player' });
}
function toggleRevealForTrade(id) {
sendCommand({ type: 'toggle-reveal-for-trading', id });
}
// TODO share with Board.jsx // TODO share with Board.jsx
// http://stackoverflow.com/questions/149055 // http://stackoverflow.com/questions/149055
function formatMoney(n) { function formatMoney(n) {

@ -91,8 +91,6 @@ const initialState = {
assets: { hay: 10, grain: 10, fruit: 0, cows: 0, harvester: 0, tractor: 0, birthday: 0 }, assets: { hay: 10, grain: 10, fruit: 0, cows: 0, harvester: 0, tractor: 0, birthday: 0 },
color: '', color: '',
name: '', name: '',
cards: [],
revealedCards: [],
ridges: { ridge1: 0, ridge2: 0, ridge3: 0, ridge4: 0 }, ridges: { ridge1: 0, ridge2: 0, ridge3: 0, ridge4: 0 },
space: 0, space: 0,
hayDoubled: false, hayDoubled: false,
@ -108,7 +106,6 @@ const initialState = {
turn: 0, turn: 0,
oldMessages: [], oldMessages: [],
name: '', name: '',
host: '',
settings: { downPayment: 0.2, settings: { downPayment: 0.2,
loanInterest: 0.2, loanInterest: 0.2,
maxDebt: 50000, maxDebt: 50000,
@ -123,10 +120,8 @@ const initialState = {
cardError: false, cardError: false,
action: false, action: false,
actionValue: null, actionValue: null,
actionId: -1,
nextAction: false, nextAction: false,
nextActionValue: null, nextActionValue: null,
nextActionId: -1,
actionChangeHandled: true, actionChangeHandled: true,
message: '', message: '',
alerts: {}, alerts: {},
@ -146,8 +141,6 @@ const initialState = {
profileTurns: 500 profileTurns: 500
} }
let lastActionId = -1;
export default function(state = initialState, action) { export default function(state = initialState, action) {
switch (action.type) { switch (action.type) {
case UPDATE_GAME: case UPDATE_GAME:
@ -213,18 +206,15 @@ export default function(state = initialState, action) {
maxHeight: action.maxHeight }}; maxHeight: action.maxHeight }};
case SET_NEXT_ACTION: case SET_NEXT_ACTION:
return { ...state, ui: { ...state.ui, nextAction: action.action, return { ...state, ui: { ...state.ui, nextAction: action.action,
nextActionValue: action.value, nextActionValue: action.value }};
nextActionId: ++lastActionId }};
case NEXT_UI_ACTION: case NEXT_UI_ACTION:
return { ...state, ui: { ...state.ui, action: state.ui.nextAction, return { ...state, ui: { ...state.ui, action: state.ui.nextAction,
actionValue: state.ui.nextActionValue, actionValue: state.ui.nextActionValue,
actionId: state.ui.nextActionId,
autoSkip: false, autoSkip: false,
actionChangeHandled: !state.ui.nextAction }}; actionChangeHandled: !state.ui.nextAction }};
case NEXT_UI_ACTION_SILENT: // don't set actionChangeHandled case NEXT_UI_ACTION_SILENT: // don't set actionChangeHandled
return { ...state, ui: { ...state.ui, action: state.ui.nextAction, return { ...state, ui: { ...state.ui, action: state.ui.nextAction,
actionValue: state.ui.nextActionValue, actionValue: state.ui.nextActionValue }};
actionId: state.ui.nextActionId }};
case MARK_ACTION_CHANGE_HANDLED: case MARK_ACTION_CHANGE_HANDLED:
return { ...state, ui: { ...state.ui, actionChangeHandled: true }}; return { ...state, ui: { ...state.ui, actionChangeHandled: true }};
case ALERT: case ALERT:

@ -26,23 +26,19 @@ import { start } from '../app/actions.js'
import LoginOrCreateAccount from '../login-or-create-account/LoginOrCreateAccount.jsx'; import LoginOrCreateAccount from '../login-or-create-account/LoginOrCreateAccount.jsx';
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome' import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'
import { faArrowCircleLeft, faCaretDown } from '@fortawesome/free-solid-svg-icons' import { faArrowCircleLeft } from '@fortawesome/free-solid-svg-icons'
import NewGame from '../new-game/NewGame.jsx' import NewGame from '../new-game/NewGame.jsx'
const JoinGameScreens = { list: 'list', details: 'details' }; const JoinGameScreens = { list: 'list', details: 'details' };
const defaultMaxGames = 5;
class JoinGame extends React.Component { class JoinGame extends React.Component {
constructor(props) { constructor(props) {
super(props); super(props);
this.state = { this.state = {
screen: JoinGameScreens.list, screen: JoinGameScreens.list,
game: null, game: null,
showSignIn: false, showSignIn: false
maxGames: defaultMaxGames,
maxOpenGames: defaultMaxGames
}; };
} }
@ -71,98 +67,69 @@ class JoinGame extends React.Component {
this.setState(state => { return { showSignIn: !state.showSignIn }; }); this.setState(state => { return { showSignIn: !state.showSignIn }; });
} }
showAllGames = (e) => {
e.preventDefault();
this.setState({ maxGames: Number.MAX_SAFE_INTEGER });
}
showAllOpenGames = (e) => {
e.preventDefault();
this.setState({ maxOpenGames: Number.MAX_SAFE_INTEGER });
}
render() { render() {
const { games, openGames } = this.props;
return ( return (
<GroupBox title={( <GroupBox title={(
<Fragment> <Fragment>
<a onClick={this.handleBack}> <a href="#" onClick={this.handleBack}>
<FontAwesomeIcon icon={faArrowCircleLeft} /> <FontAwesomeIcon icon={faArrowCircleLeft} />
</a> </a>
Join Game Join Game
</Fragment> </Fragment>
)}> )}>
<Row> <Row>
<Col width='12'> <Col width='12'>
{this.state.screen === JoinGameScreens.list ? {this.state.screen === JoinGameScreens.list ?
(<> (<>
<h3>My Games</h3> <h3>My Games</h3>
{(!this.props.user && !this.state.showSignIn) ? ( {(!this.props.user && !this.state.showSignIn) ? (
<a onClick={this.showSignIn}>Sign In to see your games</a> <a onClick={this.showSignIn}>Sign In to see your games</a>
) : (<></>)} ) : (<></>)}
{(!this.props.user && this.state.showSignIn) ? ( {(!this.props.user && this.state.showSignIn) ? (
<> <>
<hr /> <hr />
<LoginOrCreateAccount login={this.props.login} <LoginOrCreateAccount login={this.props.login}
createAccount={this.props.createAccount} createAccount={this.props.createAccount}
errors={this.props.errors} errors={this.props.errors}
showLogin={true} showLogin={true}
/> />
<hr /> <hr />
</> </>
) : (<></>)} ) : (<></>)}
<ul> <ul>
{games.slice(0, this.state.maxGames) {this.props.games
.map((g, i) => .map((g, i) =>
( (<li key={i}>
<li key={i}> <a onClick={(e) => this.handleJoinAsExisting(e, g.id)}>{g.name}</a>
<a onClick={(e) => this.handleJoinAsExisting(e, g.id)}>{g.name}</a> </li>))}
</li> </ul>
))} <h3>Open Games</h3>
{games.length > this.state.maxGames ? ( <ul>
<li> {this.props.openGames
<center> .map((g, i) =>
<a onClick={this.showAllGames}><FontAwesomeIcon icon={faCaretDown} /> Show all</a> (<li key={i}>
</center> <a onClick={e => {
</li> e.preventDefault();
) : (<></>)} this.handleClickGame(g); }}>{g.name}</a>
</ul> </li>))}
<h3>Open Games</h3> </ul>
<ul> </>
{openGames.slice(0, this.state.maxOpenGames) )
.map((g, i) => : (
( <Fragment>
<li key={i}> <h3><b>Game:</b> {this.state.game.name}</h3>
<a onClick={e => { <NewGame colors={this.state.game.colors}
e.preventDefault(); button={'Join'}
this.handleClickGame(g); }}>{g.name}</a> showGameName={false}
</li> gameName={this.state.game.name}
))} gameId={this.state.game.id}
{openGames.length > this.state.maxOpenGames ? ( type={'join-game'}
<li> hideBack={true}
<center> createAccount={this.props.createAccount}
<a onClick={this.showAllOpenGames}><FontAwesomeIcon icon={faCaretDown} /> Show all</a> login={this.props.login}
</center> errors={this.props.errors}
</li> title={'Join as New Player'} />
) : (<></>)} </Fragment>)}
</ul>
</>
)
: (
<Fragment>
<h3><b>Game:</b> {this.state.game.name}</h3>
<NewGame colors={this.state.game.colors}
button={'Join'}
showGameName={false}
gameName={this.state.game.name}
gameId={this.state.game.id}
type={'join-game'}
hideBack={true}
createAccount={this.props.createAccount}
login={this.props.login}
errors={this.props.errors}
title={'Join as New Player'} />
</Fragment>)}
</Col> </Col>
</Row> </Row>
</GroupBox> </GroupBox>

@ -42,7 +42,7 @@ export default class LoginOrCreateAccount extends React.Component {
createAccount={this.props.createAccount} /> createAccount={this.props.createAccount} />
)} )}
<div className="center"> <div className="center">
<a className="action-item" onClick={this.toggleLogin}>{this.state.showLogin ? 'Create Account' : 'Login'}</a> <a onClick={this.toggleLogin}>{this.state.showLogin ? 'Create Account' : 'Login'}</a>
</div> </div>
</> </>
); );

@ -19,23 +19,25 @@
import React, { Fragment } from 'react' import React, { Fragment } from 'react'
import { connect } from 'react-redux' import { connect } from 'react-redux'
import { Button } from '../widgets.jsx' import { GroupBox, Row, Col, Button } from '../widgets.jsx'
import { start } from '../app/actions.js' import { start } from '../app/actions.js'
const Welcome = (props) => { class Welcome extends React.Component {
return ( render() {
<Fragment> return (
<div className='intro-text'> <Fragment>
<div className='intro-text'>
<div className='game-card'> <div className='game-card'>
Your ancestors were farmers on one of the first transports to Alpha Centuari{`'`}s Proxima b. The growing season is short and harsh but the colonists depend on you for their food. Are you up to the challenge? Your ancestors were farmers on one of the first transports to Alpha Centuari{`'`}s Proxima b. The growing season is short and harsh but the colonists depend on you for their food. Are you up to the challenge?
</div> </div>
</div> </div>
<Button size='large' className='shadow intro action-item' onClick={props.start}> <Button size='large' className='shadow intro' onClick={this.props.start}>
Begin Begin
</Button> </Button>
</Fragment> </Fragment>
); );
}
} }
export default connect( export default connect(

@ -20,43 +20,51 @@ import React, { Fragment } from 'react'
export { GroupBox, Row, Col, Button } export { GroupBox, Row, Col, Button }
const GroupBox = (props) => { class GroupBox extends React.Component {
return ( render() {
<div className='panel card'> return (
{props.title ? <div className='panel card'>
(<div className='card-divider'> {this.props.title ?
{props.title} (<div className='card-divider'>
</div>) : (<Fragment />)} {this.props.title}
<div className={'card-section ' + props.className ? props.className : ''}> </div>) : (<Fragment />)}
{props.children} <div className={'card-section ' + this.props.className ? this.props.className : ''}>
{this.props.children}
</div>
</div> </div>
</div> );
); }
} }
const Row = (props) => { class Row extends React.Component {
return (<div className={'grid-x full-width ' + render() {
(props.collapse ? 'collapse' : '') + ' ' + return (<div className={'grid-x full-width ' +
(props.className ? props.className : '')} > (this.props.collapse ? 'collapse' : '') + ' ' +
{props.children}</div>); (this.props.className ? this.props.className : '')} >
{this.props.children}</div>);
}
} }
const Col = (props) => { class Col extends React.Component {
return ( render() {
<div className={'cell small-' + props.width + ' ' + (props.className ? props.className : '')}> return (
{props.children} <div className={'cell small-' + this.props.width + ' ' + (this.props.className ? this.props.className : '')}>
</div> {this.props.children}
); </div>
);
}
} }
const Button = (props) => { class Button extends React.Component {
return ( render() {
<button className={'button ' + (props.size ? props.size : '') + return (
' ' + (props.className ? props.className : '')} <button className={'button ' + (this.props.size ? this.props.size : '') +
type={props.type || 'button'} ' ' + (this.props.className ? this.props.className : '')}
disabled={props.disabled} type={this.props.type || 'button'}
onClick={props.onClick} > disabled={this.props.disabled}
{props.children} onClick={this.props.onClick} >
</button> {this.props.children}
); </button>
);
}
} }

@ -1,7 +1,6 @@
(use sql-de-lite crypt) (use sql-de-lite crypt)
;; (define *db* "/home/tjhintz/db") (define *db* "/home/tjhintz/db")
(define *db* "/farmdb/db")
(define-syntax with-db (define-syntax with-db
(syntax-rules () (syntax-rules ()
@ -11,17 +10,12 @@
body ...))))) body ...)))))
(define (create-tables) (define (create-tables)
(when (not (file-exists? *db*))
(call-with-output-file *db*
(lambda (output-port)
""
)))
(with-db (db) (with-db (db)
(exec (sql db "create table if not exists users(id INTEGER PRIMARY KEY, username TEXT, email TEXT, password TEXT, salt TEXT);")) (exec (sql db "create table users(id INTEGER PRIMARY KEY, username TEXT, email TEXT, password TEXT, salt TEXT);"))
(exec (sql db "create table if not exists sessions(bindings TEXT, session_id TEXT PRIMARY KEY);")) (exec (sql db "create table sessions(bindings TEXT, session_id TEXT PRIMARY KEY);"))
(exec (sql db "create table if not exists games(id INTEGER PRIMARY KEY, status TEXT, object TEXT, updated INTEGER);")) (exec (sql db "create table games(id INTEGER PRIMARY KEY, status TEXT, object TEXT, updated INTEGER);"))
(exec (sql db "create table if not exists players(id INTEGER PRIMARY KEY, object TEXT);")) (exec (sql db "create table players(id INTEGER PRIMARY KEY, object TEXT);"))
(exec (sql db "create table if not exists user_games(user_id INTEGER, game_id INTEGER);")))) (exec (sql db "create table user_games(user_id INTEGER, game_id INTEGER);"))))
(define (db-session-set! sid bindings) (define (db-session-set! sid bindings)
(with-db (db) (with-db (db)
@ -68,12 +62,6 @@
(string=? (crypt password (alist-ref 'salt user)) (string=? (crypt password (alist-ref 'salt user))
(alist-ref 'password user)))) (alist-ref 'password user))))
(define (unsecure-set-password username password)
(let ((salt (crypt-gensalt)))
(with-db (db)
(exec (sql db "update users set password=?, salt=? where username=?;")
(crypt password salt) salt username))))
(define (alist->string alist) (define (alist->string alist)
(with-output-to-string (lambda () (write alist)))) (with-output-to-string (lambda () (write alist))))

File diff suppressed because it is too large Load Diff

@ -16,20 +16,6 @@
// along with the Alpha Centauri Farming project. If not, see // along with the Alpha Centauri Farming project. If not, see
// <https://www.gnu.org/licenses/>. // <https://www.gnu.org/licenses/>.
@font-face {
font-family: 'IndieFlower-Regular';
src: url('../assets/font/IndieFlower-Regular.woff2') format('woff2'),
url('../assets/font/IndieFlower-Regular.woff') format('woff'),
url('../assets/font/IndieFlower-Regular.ttf') format('truetype');
}
// @font-face {
// font-family: 'LibreBaskerville-Regular';
// src: url('../assets/font/LibreBaskerville-Regular.woff2') format('woff2'),
// url('../assets/font/LibreBaskerville-Regular.woff') format('woff'),
// url('../assets/font/LibreBaskerville-Regular.ttf') format('truetype');
// }
@import './foundation/foundation'; @import './foundation/foundation';
// Global styles // Global styles
@ -173,8 +159,6 @@ $tab-margin: 0.3rem;
width: 100%; } width: 100%; }
.space { .space {
font-family: 'IndieFlower-Regular';
// font-family: 'LibreBaskerville-Regular';
flex-grow: 1; flex-grow: 1;
flex-basis: 0; flex-basis: 0;
padding: 3px; padding: 3px;
@ -185,7 +169,6 @@ $tab-margin: 0.3rem;
font-size: 4px; } font-size: 4px; }
@include breakpoint(large) { @include breakpoint(large) {
font-size: 14px; } font-size: 14px; }
text-shadow: 0px 0px 2px black;
} }
.space-description { .space-description {
@ -261,23 +244,6 @@ $tab-margin: 0.3rem;
margin-top: 4px; margin-top: 4px;
margin-left: 5px; } margin-left: 5px; }
.player-current {
position: relative;
box-shadow: 0 1px 2px rgba(0,0,0,0.15);
transition: all 0.3s ease-in-out; }
.player-current::after {
content: '';
position: absolute;
width: 100%;
height: 100%;
border-radius: 12px;
top: 0;
left: 0;
background-color: rgba(255, 255, 255, 0.5);
box-shadow: 0 0px 5px $primary-color;
animation: die-pulse 2s ease-in-out infinite; }
.player-selectable { .player-selectable {
border: 4px solid #ff816e; border: 4px solid #ff816e;
cursor: pointer; cursor: pointer;
@ -305,7 +271,7 @@ $tab-margin: 0.3rem;
.player-black { .player-black {
background-color: black; } background-color: black; }
.player-none { .player-none {
background-color: #f2f2f2; } // background-color: #f2f2f2; }
.tab .player { .tab .player {
height: 27px; height: 27px;
@ -471,107 +437,21 @@ $trade-margin: 3rem;
.space-type-hay { .space-type-hay {
background-color: hsla(120, 100%, 25%, 0.19); } background-color: hsla(120, 100%, 25%, 0.19); }
.space-type-hay::after {
background: url('../assets/img/hay.svg') repeat;
content: '';
width: 100%;
height: 100%;
opacity: 0.2;
z-index: -1;
position: absolute;
filter: invert(42%) sepia(93%) saturate(1352%) hue-rotate(87deg) brightness(119%) contrast(119%);
background-size: auto 100%;
top: 0;
left: 0; }
.space-type-cherry { .space-type-cherry {
background-color: hsla(0, 100%, 40%, 0.28); } background-color: hsla(0, 100%, 40%, 0.28); }
.space-type-cherry::after {
background: url('../assets/img/fruit.svg') repeat;
content: '';
width: 100%;
height: 100%;
opacity: 0.1;
z-index: -1;
position: absolute;
filter: invert(13%) sepia(54%) saturate(6280%) hue-rotate(358deg) brightness(98%) contrast(123%);
background-size: auto 50%;
background-position: right;
top: 0;
left: 0; }
.space-type-apple { .space-type-apple {
background-color: hsla(0, 100%, 40%, 0.28); } background-color: hsla(0, 100%, 40%, 0.28); }
.space-type-apple::after {
background: url('../assets/img/fruit.svg') repeat;
content: '';
width: 100%;
height: 100%;
opacity: 0.1;
z-index: -1;
position: absolute;
filter: invert(13%) sepia(54%) saturate(6280%) hue-rotate(358deg) brightness(98%) contrast(123%);
background-size: auto 50%;
background-position: right;
top: 0;
left: 0; }
.space-type-wheat { .space-type-wheat {
background-color: hsla(50, 97%, 48%, 0.22); } background-color: hsla(50, 97%, 48%, 0.22); }
.space-type-wheat::after {
background: url('../assets/img/wheat.svg') repeat;
content: '';
width: 100%;
height: 100%;
opacity: 0.2;
z-index: -1;
position: absolute;
filter: invert(68%) sepia(58%) saturate(747%) hue-rotate(8deg) brightness(102%) contrast(106%);
background-size: auto 110%;
background-position: right;
top: 0;
left: 0; }
.space-type-corn { .space-type-corn {
background-color: hsla(50, 97%, 48%, 0.22); } background-color: hsla(50, 97%, 48%, 0.22); }
.space-type-corn::after {
background: url('../assets/img/wheat.svg') repeat;
content: '';
width: 100%;
height: 100%;
opacity: 0.2;
z-index: -1;
position: absolute;
filter: invert(68%) sepia(58%) saturate(747%) hue-rotate(8deg) brightness(102%) contrast(106%);
background-size: auto 110%;
background-position: right;
top: 0;
left: 0; }
.space-type-cows { .space-type-cows {
background-color: hsla(0, 25%, 43%, 0.49); } background-color: hsla(0, 25%, 43%, 0.49); }
.space-type-cows::after {
background: url('../assets/img/cow.svg') repeat;
content: '';
width: 100%;
height: 100%;
opacity: 0.2;
z-index: -1;
position: absolute;
filter: invert(43%) sepia(5%) saturate(4943%) hue-rotate(314deg) brightness(76%) contrast(75%);
background-size: auto 35%;
background-position: right;
top: 0;
left: 0; }
.space-type-buy {
background-color: hsla(240, 100%, 85%, 0.15); }
.space-title { .space-title {
text-align: center; text-align: center;
font-style: italic; } font-style: italic; }
@ -806,14 +686,6 @@ $trade-margin: 3rem;
padding: 0.5rem; padding: 0.5rem;
display: none; } display: none; }
.tab.border-top {
$tab-border: 0.3rem solid $primary-color;
border-top: $tab-border;
border-bottom: none;
border-left: none;
border-right: none;
}
.tab.show { .tab.show {
display: block; } display: block; }
@ -880,7 +752,6 @@ $trade-margin: 3rem;
margin-top: 1rem; } margin-top: 1rem; }
.clear-background { .clear-background {
position: relative;
background: white; } background: white; }
.harvest-card { .harvest-card {
@ -927,6 +798,8 @@ $trade-margin: 3rem;
color: white; } color: white; }
.alert-overlay-contents { .alert-overlay-contents {
max-height: 90vh;
overflow: auto;
background: $light-color; background: $light-color;
padding: 2rem; padding: 2rem;
display: flex; display: flex;
@ -934,10 +807,6 @@ $trade-margin: 3rem;
justify-content: center; justify-content: center;
align-items: center; } align-items: center; }
.alert-container {
max-height: 90vh;
overflow: auto; }
.moving { .moving {
display: flex; display: flex;
justify-content: center; justify-content: center;
@ -1059,27 +928,70 @@ $intro-time: 6s;
position: absolute; position: absolute;
bottom: 1rem; } bottom: 1rem; }
.lobby-icon { /* -------- MENU ------- */
cursor: pointer; /* Position and sizing of burger button */
margin-left: 0.2rem; } .bm-burger-button {
position: fixed;
width: 36px;
height: 30px;
left: 36px;
top: 36px;
}
.kick-player { /* Color/shape of burger icon bars */
color: red; } .bm-burger-bars {
background: #373a47;
}
.birthday-selected { /* Color/shape of burger icon bars on hover*/
color: blue; } .bm-burger-bars-hover {
background: #a90000;
}
ul { /* Position and sizing of clickable cross button */
margin-left: 0; .bm-cross-button {
list-style-type: none; } height: 24px;
width: 24px;
}
.font-preloader { /* Color/shape of close button cross */
font-family: 'IndieFlower-Regular'; .bm-cross {
width: 0; background: #bdc3c7;
height: 0; } }
.game-over p { /*
margin-bottom: 0.2rem; Sidebar wrapper styles
text-align: left; Note: Beware of modifying this element as it can break the animations - you should not need to touch it in most cases
width: 100%; */
.bm-menu-wrap {
position: fixed;
height: 100%;
}
/* General sidebar styles */
.bm-menu {
background: #373a47;
padding: 2.5em 1.5em 0;
font-size: 1.15em;
}
/* Morph shape necessary with bubble or elastic */
.bm-morph-shape {
fill: #373a47;
}
/* Wrapper for item list */
.bm-item-list {
color: #b8b7ad;
padding: 0.8em;
}
/* Individual item */
.bm-item {
display: inline-block;
}
/* Styling of overlay */
.bm-overlay {
background: rgba(0, 0, 0, 0.3);
} }

@ -19,7 +19,7 @@
const path = require('path'); const path = require('path');
const HtmlWebpackPlugin = require('html-webpack-plugin'); const HtmlWebpackPlugin = require('html-webpack-plugin');
const { CleanWebpackPlugin } = require('clean-webpack-plugin'); const { CleanWebpackPlugin } = require('clean-webpack-plugin');
// const FaviconsWebpackPlugin = require('favicons-webpack-plugin') const FaviconsWebpackPlugin = require('favicons-webpack-plugin')
const MiniCssExtractPlugin = require('mini-css-extract-plugin'); const MiniCssExtractPlugin = require('mini-css-extract-plugin');
const CopyPlugin = require('copy-webpack-plugin'); const CopyPlugin = require('copy-webpack-plugin');
const webpack = require("webpack"); const webpack = require("webpack");
@ -28,10 +28,10 @@ const CssUrlRelativePlugin = require('css-url-relative-plugin')
module.exports = { module.exports = {
entry: { entry: {
app: './src/index.jsx', app: './src/main.jsx',
}, },
output: { output: {
filename: './assets/[name].[hash].js', filename: './assets/[name].[contenthash].js',
path: path.resolve(__dirname, 'dist'), path: path.resolve(__dirname, 'dist'),
}, },
optimization: { optimization: {
@ -48,10 +48,15 @@ module.exports = {
}, },
plugins: [ plugins: [
new CleanWebpackPlugin(), new CleanWebpackPlugin(),
// new FaviconsWebpackPlugin('./assets/img/tractor.svg'), new HtmlWebpackPlugin({
title: 'Alpha Centauri Farming',
filename: 'main.html',
meta: {viewport: 'width=device-width, initial-scale=1'},
}),
new FaviconsWebpackPlugin('./assets/img/tractor.svg'),
new MiniCssExtractPlugin({ new MiniCssExtractPlugin({
filename: './assets/[name].[hash].css', filename: './assets/[name].[contenthash].css',
chunkFilename: './assets/[id].[hash].css', chunkFilename: './assets/[id].[contenthash].css',
}), }),
new CopyPlugin([ new CopyPlugin([
{ from: './src/server/farm.scm', to: './[name].[ext]' }, { from: './src/server/farm.scm', to: './[name].[ext]' },
@ -88,17 +93,10 @@ module.exports = {
// }, // },
// }, // },
{ {
test: /\.(svg|png|gif)$/, test: /\.(woff|woff2|eot|ttf|otf|svg|png|gif)$/,
loader: 'file-loader',
options: {
name: './assets/img/[name].[hash].[ext]',
},
},
{
test: /\.(woff|woff2|eot|ttf|otf)$/,
loader: 'file-loader', loader: 'file-loader',
options: { options: {
name: './assets/font/[name].[hash].[ext]', name: './assets/img/[name].[contenthash].[ext]',
}, },
}, },
{ {

@ -19,54 +19,15 @@
const merge = require('webpack-merge'); const merge = require('webpack-merge');
const common = require('./webpack.common.js'); const common = require('./webpack.common.js');
const path = require('path'); const path = require('path');
const HtmlWebpackPlugin = require('html-webpack-plugin');
const ReactRefreshWebpackPlugin = require('@pmmmwh/react-refresh-webpack-plugin');
const webpack = require('webpack');
module.exports = function(env) { module.exports = function(env) {
return merge(common, { return merge(common, {
mode: 'development', mode: 'development',
devtool: 'inline-source-map', devtool: 'inline-source-map',
devServer: {
port: 9000,
contentBase: './dist',
hot: true,
proxy: {
'/websocket': {
target: 'ws://localhost:8080',
ws: true
},
},
},
resolve: { resolve: {
modules: [path.resolve(__dirname, 'src'), modules: [path.resolve(__dirname, 'src'),
path.resolve(__dirname, env.assets), path.resolve(__dirname, env.assets),
'node_modules'] 'node_modules']
}, },
plugins: [
new webpack.HotModuleReplacementPlugin(),
new ReactRefreshWebpackPlugin(),
new HtmlWebpackPlugin({
title: 'Alpha Centauri Farming',
filename: 'index.html',
meta: {viewport: 'width=device-width, initial-scale=1'},
}),
],
module: {
rules: [
{
test: /\.jsx?$/,
exclude: /node_modules/,
use: [
{
loader: require.resolve('babel-loader'),
options: {
plugins: [require.resolve('react-refresh/babel')],
},
},
],
},
],
},
}); });
} }

@ -21,8 +21,6 @@ const common = require('./webpack.common.js');
const path = require('path'); const path = require('path');
const OptimizeCssAssetsPlugin = require('optimize-css-assets-webpack-plugin'); const OptimizeCssAssetsPlugin = require('optimize-css-assets-webpack-plugin');
const TerserPlugin = require('terser-webpack-plugin');
const HtmlWebpackPlugin = require('html-webpack-plugin');
module.exports = function(env) { module.exports = function(env) {
return merge(common, { return merge(common, {
@ -33,16 +31,8 @@ module.exports = function(env) {
path.resolve(__dirname, env.assets), path.resolve(__dirname, env.assets),
'node_modules'] 'node_modules']
}, },
plugins: [
new HtmlWebpackPlugin({
title: 'Alpha Centauri Farming',
filename: 'main.html',
meta: {viewport: 'width=device-width, initial-scale=1'},
}),
],
optimization: { optimization: {
minimize: true, minimizer: [new OptimizeCssAssetsPlugin({})],
minimizer: [new OptimizeCssAssetsPlugin({}), new TerserPlugin()],
}, },
}); });
} }

Loading…
Cancel
Save