Skip to content

Commit

Permalink
refactored some compoents
Browse files Browse the repository at this point in the history
  • Loading branch information
psnider committed Mar 31, 2022
1 parent ecdacde commit d90c90a
Show file tree
Hide file tree
Showing 19 changed files with 207 additions and 140 deletions.
1 change: 0 additions & 1 deletion ReadMe.md
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,6 @@ These messages time-out as appropriate.

- The background doesn't display correctly on mobile devices.
- Duplicate messages may be displayed in either message area.
- The hamburger menu has inconsistent style.
- The New Game Controls should display a completion message for a few seconds immediately after a new game is started.
- There is no way for the user to contest a word.
- Must add coding style management, such as [TypeScript ESLint](https://typescript-eslint.io/).
Expand Down
1 change: 1 addition & 0 deletions dist/app.6b185cf835dc2d2ee69d.bundle.js

Large diffs are not rendered by default.

1 change: 0 additions & 1 deletion dist/app.bb8cb7c14fc576035310.bundle.js

This file was deleted.

2 changes: 1 addition & 1 deletion dist/index.html
Original file line number Diff line number Diff line change
@@ -1 +1 @@
<!doctype html><html style="height:100%;width:100%;"><head><meta charset="utf-8"><title>License Plate Game</title><meta name="viewport" content="width=device-width,initial-scale=1"><base href="/"><link rel="icon" href="favicon.ico"><script defer="defer" src="/runtime~app.450b9e5fc6deafa566fa.bundle.js"></script><script defer="defer" src="/vendors-7e9c6a9f.1adc9f385b3ac86c2788.bundle.js"></script><script defer="defer" src="/vendors-319a6989.a80424c5fae4edbd79e3.bundle.js"></script><script defer="defer" src="/vendors-4e64aa37.9e9c6bc89f49649635e3.bundle.js"></script><script defer="defer" src="/vendors-3ce50090.b281a0f6725a5f032f6a.bundle.js"></script><script defer="defer" src="/vendors-fcadf5bb.99541182c2a6c79ed0a2.bundle.js"></script><script defer="defer" src="/vendors-cdd60c62.abf102d6ed9d6bb32f06.bundle.js"></script><script defer="defer" src="/app.bb8cb7c14fc576035310.bundle.js"></script></head><body aurelia-app="main"></body></html>
<!doctype html><html style="height:100%;width:100%;"><head><meta charset="utf-8"><title>License Plate Game</title><meta name="viewport" content="width=device-width,initial-scale=1"><base href="/"><link rel="icon" href="favicon.ico"><script defer="defer" src="/runtime~app.450b9e5fc6deafa566fa.bundle.js"></script><script defer="defer" src="/vendors-7e9c6a9f.1adc9f385b3ac86c2788.bundle.js"></script><script defer="defer" src="/vendors-319a6989.a80424c5fae4edbd79e3.bundle.js"></script><script defer="defer" src="/vendors-4e64aa37.9e9c6bc89f49649635e3.bundle.js"></script><script defer="defer" src="/vendors-3ce50090.b281a0f6725a5f032f6a.bundle.js"></script><script defer="defer" src="/vendors-fcadf5bb.99541182c2a6c79ed0a2.bundle.js"></script><script defer="defer" src="/vendors-cdd60c62.abf102d6ed9d6bb32f06.bundle.js"></script><script defer="defer" src="/app.6b185cf835dc2d2ee69d.bundle.js"></script></head><body aurelia-app="main"></body></html>
32 changes: 1 addition & 31 deletions src/Banner.css
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
grid-template-columns: 10fr 80fr 10fr;
grid-gap: 0px;
}
.hamburger-menu-container {
.menu-container {
flex: 0 0 10%;
position: relative;
display: inline-block;
Expand All @@ -17,38 +17,8 @@
/* empty-right-header-container requires no CSS */



/* hamburger menu */
.hamburger-menu {
margin: 5px;
width: 20px;
height: 20px;
}
.dropdown-content {
display: none;
position: absolute;
/* background-color: #f1f1f1; */
min-width: 160px;
/* box-shadow: 0px 8px 16px 0px rgba(0,0,0,0.2); */
z-index: 1;
}
.dropdown-content button {
color: black;
padding: 6px 6px;
text-decoration: none;
display: block;
}
.dropdown-content a:hover {
background-color: #ddd;
}
.hamburger-menu-container:hover .dropdown-content {
display: block;
}


/* page title */
.banner-header {
font-size: 2em;
}

/* See SystemMessagesSignboard.css */
10 changes: 3 additions & 7 deletions src/Banner.html
Original file line number Diff line number Diff line change
@@ -1,15 +1,11 @@
<template>
<require from="./Banner.css"></require>
<require from="./HamburgerMenu"></require>
<require from="./SystemMessagesSignboard"></require>

<header class="page-header-container">
<div class="hamburger-menu-container">
<div><img class="hamburger-menu" src="../static/menu-icon.svg"/></div>
<div class="dropdown-content">
<button click.delegate="openAboutPanel()">About...</button>
<button click.delegate="openFeedbackPanel()">Feedback... 😊 🙁</button>
</div>
<in-process-indicator if.bind="in_process_count > 0" ></in-process-indicator>
<div class="menu-container">
<hamburger-menu></hamburger-menu>
</div>
<div class="banner-container">
<div class="banner-header" title="built with Aurelia!">Make a Word from a License Plate <img src="../static/aurelia-logo.svg" width="25" height="25" /><img src="../static/Typescript_logo_2020.svg" width="25" height="25" /></div>
Expand Down
19 changes: 2 additions & 17 deletions src/Banner.ts
Original file line number Diff line number Diff line change
@@ -1,24 +1,9 @@
import {autoinject, bindable} from 'aurelia-framework';
import {AuMsgAboutPanelState, AuMsgFeedbackPanelState} from 'messages';
import {EventAggregator} from 'aurelia-event-aggregator';
import {bindable} from 'aurelia-framework';


@autoinject
export class Banner {
@bindable in_process_count: number

constructor(private ea: EventAggregator) {
}


openAboutPanel() {
this.ea.publish(new AuMsgAboutPanelState(true));
}


openFeedbackPanel() {
this.ea.publish(new AuMsgFeedbackPanelState(true));
}
@bindable in_process_count: number

}

Expand Down
25 changes: 21 additions & 4 deletions src/FeedbackPanel.css
Original file line number Diff line number Diff line change
@@ -1,14 +1,30 @@
.feedback-panel{
background-color: rgb(248, 248, 93);
background-color: rgb(205, 233, 255);
width: 50%;
margin: 15px;
padding: 5px;
color: black;
border: 1px solid black;
border-radius: 8px;
}
.feedback-header {
font-size: 1.2em;
}
.rating-button-spacing {
padding: 5px;
}
.feedback-text {
box-sizing: border-box;
width: 100%;
max-width: 100%;
padding: 5px;
}
.feedback-button {
font-size: 1em;
border-radius: 8px;
width: 140px;
border-radius: 4px;
/* width: 140px; */
height: 30px;
padding: 2px;
padding: 4px;
margin: 2px;
display: inline-flex;
align-items: center;
Expand All @@ -18,5 +34,6 @@
/* color: rgb(21, 98, 241); */
/* background-color: rgb(231, 247, 248); */
border: 1px solid black;
border-radius: 8px;
}

14 changes: 5 additions & 9 deletions src/FeedbackPanel.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,26 +6,22 @@
<div >
<div if.bind="feedback_panel_is_open" >
<div id="feedback-panel" class="feedback-panel">
<h3>Please provide your suggestions, or describe any problems you found...</h3>
<div class="toggle-radio" data-style="rounded">
<div class="feedback-header" >Please provide your suggestions,<br>or describe any problems you found...</div>
<div class="toggle-radio rating-button-spacing" data-style="rounded">
<input type="radio" id="good-rating" name="rating" value="good" checked.bind="rating" />
<label for="good-rating">😊</label>
<input type="radio" id="poor-rating" name="rating" value="poor" checked.bind="rating" />
<label for="poor-rating">🙁</label>
</div>
<div>
<!-- TODO: add pattern back in: <textarea pattern="\w*" -->
<textarea title="Please provide your suggestions, or describe any problems you found." id="feedback-text" value.bind="comments" rows="3" ></textarea>
<textarea id="feedback-text" class="feedback-text" title="Please provide your suggestions, or describe any problems you found." value.bind="comments" rows="3" ></textarea>
</div>
<div>
<button type="button" click.delegate="sendFeedback()" >Send Feedback</button>
<button type="button" click.delegate="closePanel()" >...or not!</button>
<button class="feedback-button" type="button" click.delegate="sendFeedback()" >Send Feedback</button>
<button class="feedback-button" type="button" click.delegate="closePanel()" >...or not!</button>
</div>
</div>
</div>

<div if.bind="!feedback_panel_is_open" >
<button id="feedback-button" class="feedback-button" click.delegate="openPanel()" >Feedback: 😊 🙁</button>
</div>
</div>
</template>
40 changes: 40 additions & 0 deletions src/FramedLicensePlate.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
.license-plate-frame {
background-image: url(./css/license-plates/metal-sheet.jpg);
background-size: cover;
border-radius: 10px;
width: 1000px;
height: 600px;
margin: 5px;
border: 2px solid black;

display: flex;
flex-direction: column;
justify-content: center;
}
.top-of-license-frame-size {
width: 95%;
height: 15%;
margin: 0 auto;
}
.license-plate-frame-interior {
background-image: url(./css/license-plates/license-plate-oregon.jpg);
background-size: cover;
border-radius: 8px;
width: 90%;
height: 70%;
border: 2px solid darkblue;
padding: 20px;
margin: 0 auto;
}
.license-plate-flex-container {
height: 100%;
width: 100%;
align-items: center;
display: flex;
flex-direction: column;
justify-content: center;
}
.answers-container {
height: 100%;
width: 100%;
}
23 changes: 23 additions & 0 deletions src/FramedLicensePlate.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<template>
<require from="./css/general.css"></require>
<require from="./FramedLicensePlate.css"></require>
<require from="./TopOfLicensePlateFrame"></require>
<require from="./LicensePlateAnswerEditorFreeEntry"></require>
<require from="./AnswersPanel"></require>
<require from="./CurrentGameControls"></require>

<div class="license-plate-frame">
<div class="top-of-license-frame-size" >
<top-of-license-plate-frame current_game.bind="current_game" ></top-of-license-plate-frame>
</div>
<div class="license-plate-frame-interior">
<div id="license-plate-text-entry" if.bind="!answers_panel_is_open" class="license-plate-flex-container">
<license-plate-answer-editor-free-entry settings.bind="settings" current_game.bind="current_game" hint.bind="hint" ></license-plate-answer-editor-free-entry>
</div>
<div id="answers-panel" if.bind="answers_panel_is_open" class="answers-container" >
<answers-panel puzzle_answers.bind="puzzle_answers"></answers-panel>
</div>
</div>
<current-game-controls if.bind="current_game" elapsed_seconds.bind="elapsed_seconds" answers_panel_is_open.bind="answers_panel_is_open" ></current-game-controls>
</div>
</template>
30 changes: 30 additions & 0 deletions src/FramedLicensePlate.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
import {bindable, autoinject, observable} from 'aurelia-framework';
import {EventAggregator} from 'aurelia-event-aggregator';
import {AuMsgAnswersPanelState} from './messages';
import type {LicensePlatePuzzle} from "./lib/license-plate-puzzle"
import type {LicensePlateGameAPI} from "license-plate-game-api"
import {Settings, PuzzleAnswer} from "./lib"


// The container for the interior of the license plate frame.
// It displays either:
// - the input component and the game status messages component
// - the scored answers
@autoinject
export class FramedLicensePlate {
@bindable settings: Settings
@bindable @observable current_game: LicensePlatePuzzle | undefined
@bindable @observable elapsed_seconds: number
@bindable @observable puzzle_answers: PuzzleAnswer[]
@bindable @observable hint: LicensePlateGameAPI.HintResponse | undefined
answers_panel_is_open: boolean


constructor(private ea: EventAggregator) {
this.answers_panel_is_open = false
this.ea.subscribe(AuMsgAnswersPanelState, (msg: AuMsgAnswersPanelState) => {
this.answers_panel_is_open = msg.is_open
})
}

}
35 changes: 35 additions & 0 deletions src/HamburgerMenu.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@

/* hamburger menu */
.hamburger-menu-container {
position: relative;
display: inline-block;
}

.hamburger-menu {
margin: 5px;
width: 20px;
height: 20px;
}
.dropdown-content {
display: none;
position: absolute;
/* background-color: #f1f1f1; */
min-width: 160px;
/* box-shadow: 0px 8px 16px 0px rgba(0,0,0,0.2); */
z-index: 1;
}
.dropdown-content button {
color: black;
margin: 1px;
padding: 4px;
text-decoration: none;
display: block;
border: 1px solid black;
border-radius: 4px;
}
.dropdown-content a:hover {
background-color: #ddd;
}
.hamburger-menu-container:hover .dropdown-content {
display: block;
}
12 changes: 12 additions & 0 deletions src/HamburgerMenu.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<template>
<require from="./HamburgerMenu.css"></require>

<div class="hamburger-menu-container">
<div><img class="hamburger-menu" src="../static/menu-icon.svg"/></div>
<div class="dropdown-content">
<button click.delegate="openAboutPanel()">About...</button>
<button click.delegate="openFeedbackPanel()">Feedback... 😊 🙁</button>
</div>
</div>
</template>

24 changes: 24 additions & 0 deletions src/HamburgerMenu.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import {autoinject} from 'aurelia-framework';
import {AuMsgAboutPanelState, AuMsgFeedbackPanelState} from 'messages';
import {EventAggregator} from 'aurelia-event-aggregator';


@autoinject
export class HamburgerMenu {

constructor(private ea: EventAggregator) {
}


openAboutPanel() {
this.ea.publish(new AuMsgAboutPanelState(true));
}


openFeedbackPanel() {
this.ea.publish(new AuMsgFeedbackPanelState(true));
}

}


39 changes: 0 additions & 39 deletions src/LicensePlateAnswerEditorFreeEntry.css
Original file line number Diff line number Diff line change
@@ -1,43 +1,4 @@
.license-plate-frame {
background-image: url(./css/license-plates/metal-sheet.jpg);
background-size: cover;
border-radius: 10px;
width: 1000px;
height: 600px;
margin: 5px;
border: 2px solid black;

display: flex;
flex-direction: column;
justify-content: center;
}
.license-plate-frame-interior {
background-image: url(./css/license-plates/license-plate-oregon.jpg);
background-size: cover;
border-radius: 8px;
width: 90%;
height: 70%;
border: 2px solid darkblue;
padding: 20px;
margin: 0 auto;
}
.license-plate-flex-container {
height: 100%;
width: 100%;
align-items: center;
display: flex;
flex-direction: column;
justify-content: center;
}
.answers-container {
height: 100%;
width: 100%;
}
.top-of-license-frame-size {
width: 95%;
height: 15%;
margin: 0 auto;
}
.license-plate-top {
width: 95%;
height: 20%;
Expand Down
Loading

0 comments on commit d90c90a

Please sign in to comment.