Skip to content

Commit ef9d349

Browse files
committed
Add icons to app and refactoring toolbar
I've chosen to manually include fonts in the web app so that work on new font assets can be done in parallel to app development, so that I'm not inadventantly making breaking changes in the app when there are changes to the icon font. This also works well as a flow if the font icon ends up moving to it's own repository.
1 parent 298d95c commit ef9d349

File tree

12 files changed

+83
-10
lines changed

12 files changed

+83
-10
lines changed

src/web/components/panels/event-types-panel.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { useState, useEffect } from 'react'
2-
import { useSocket, useEventListener } from 'components/socket'
2+
import { useSocket, useEventListener } from 'lib/socket'
33

44
function gameEventsToArray (gameEvents) {
55
return Object.keys(gameEvents).map(event => {

src/web/components/toolbar.js

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
import { toggleFullScreen } from 'lib/window'
2+
3+
export default function Toolbar ({ connected }) {
4+
return (
5+
<>
6+
<h2 style={{ padding: '1rem 0' }}>ICARUS Terminal</h2>
7+
<div style={{ position: 'absolute', top: '1rem', right: '1rem' }}>
8+
<button disabled className='button-with-icon button-transparent' style={{ opacity: 1, marginRight: '.5rem' }}>
9+
<i className={`icarus-terminal-signal ${connected ? 'text-primary' : 'text-danger text-blink'}`} />
10+
</button>
11+
<button onClick={toggleFullScreen} className='button-with-icon'>
12+
<i className='icarus-terminal-fullscreen' />
13+
</button>
14+
</div>
15+
</>
16+
)
17+
}

src/web/css/buttons.css

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,3 +24,21 @@ button:not(:disabled):active {
2424
background: var(--secondary-color);
2525
color: var(--dark-secondary-color);
2626
}
27+
28+
button.button-with-icon {
29+
position: relative;
30+
height: 3rem;
31+
width: 3rem;
32+
display: inline-block;
33+
min-width: initial;
34+
padding: 0;
35+
}
36+
37+
button.button-with-icon > * {
38+
font-size: 2rem;
39+
line-height: 3rem;
40+
}
41+
42+
button.button-transparent {
43+
background: none;
44+
}

src/web/css/icarus-terminal-font.css

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
@font-face {
2+
font-family: "icarus-terminal";
3+
src: url('../public/fonts/icarus-terminal.ttf?t=1637863636375') format('truetype');
4+
}
5+
6+
[class^="icarus-terminal-"], [class*=" icarus-terminal-"] {
7+
font-family: 'icarus-terminal' !important;
8+
font-style: normal;
9+
font-weight: 500;
10+
-webkit-font-smoothing: antialiased;
11+
-moz-osx-font-smoothing: grayscale;
12+
}
13+
14+
.icarus-terminal-asteroid-base:before { content: "\ea01"; }
15+
.icarus-terminal-coriolis-starport:before { content: "\ea02"; }
16+
.icarus-terminal-credits:before { content: "\ea03"; }
17+
.icarus-terminal-engineering:before { content: "\ea04"; }
18+
.icarus-terminal-fullscreen-window:before { content: "\ea05"; }
19+
.icarus-terminal-fullscreen:before { content: "\ea06"; }
20+
.icarus-terminal-ocellus-starport:before { content: "\ea07"; }
21+
.icarus-terminal-orbis-starport:before { content: "\ea08"; }
22+
.icarus-terminal-outpost:before { content: "\ea09"; }
23+
.icarus-terminal-planet:before { content: "\ea0a"; }
24+
.icarus-terminal-planetary-port:before { content: "\ea0b"; }
25+
.icarus-terminal-route:before { content: "\ea0c"; }
26+
.icarus-terminal-signal:before { content: "\ea0d"; }
27+
.icarus-terminal-star:before { content: "\ea0e"; }
28+
.icarus-terminal-system-bodies:before { content: "\ea0f"; }
29+
.icarus-terminal-system-orbits:before { content: "\ea10"; }
30+
.icarus-terminal-table:before { content: "\ea11"; }

src/web/css/main.css

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@
77
@import "panels.css";
88
@import "table.css";
99

10+
@import "icarus-terminal-font.css";
11+
1012
@font-face {
1113
font-family: 'Jura';
1214
src: url('../public/fonts/Jura-VariableFont_wght.ttf') format('truetype');

src/web/css/text.css

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,4 +40,12 @@
4040

4141
.text-right {
4242
text-align: right;
43+
}
44+
45+
.text-blink {
46+
animation: text-blink-animation .5s ease-in-out infinite;
47+
}
48+
49+
@keyframes text-blink-animation {
50+
50% { opacity: 0; }
4351
}
File renamed without changes.

src/web/lib/window.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
/* global Element */
12
function toggleFullScreen () {
23
if (typeof window.app_toggleFullScreen === 'function') { return window.app_toggleFullScreen() }
34

@@ -20,7 +21,7 @@ function toggleFullScreen () {
2021
}
2122
}
2223

23-
function newWindow() {
24+
function newWindow () {
2425
if (typeof window.app_newWindow === 'function') { return window.app_newWindow() }
2526

2627
window.open(`//${window.location.host}`)

src/web/pages/_app.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import '../css/main.css'
2-
import { Socket } from 'components/socket'
2+
import { Socket } from 'lib/socket'
33

44
export default function MyApp ({ Component, pageProps }) {
55
return (

src/web/pages/index.js

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
import { useState, useEffect } from 'react'
2-
import { toggleFullScreen } from 'lib/window'
2+
import Toolbar from 'components/toolbar'
33
import Loader from 'components/loader'
44
import Panel from 'components/panel'
55
import LogPanel from 'components/panels/log-panel'
6-
import { useSocket, useEventListener } from 'components/socket'
6+
import { useSocket, useEventListener } from 'lib/socket'
77

88
let loadNewLogEntries
99

@@ -38,12 +38,9 @@ export default function IndexPage () {
3838

3939
return (
4040
<>
41+
<Toolbar connected={connected} />
4142
<Loader visible={!connected || logEntries.length === 0} />
4243
<Panel visible={connected && logEntries.length > 0}>
43-
<h2 style={{ padding: '1rem 0' }}>ICARUS Terminal</h2>
44-
<div style={{ position: 'absolute', top: '1rem', right: '1rem' }}>
45-
<button onClick={toggleFullScreen}>Toggle Fullscreen</button>
46-
</div>
4744
<div className='scrollable' style={{ position: 'absolute', top: '5rem', bottom: '1rem', left: '1rem', right: '1rem' }}>
4845
<LogPanel logEntries={logEntries} />
4946
</div>

src/web/pages/launcher.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { useState, useEffect } from 'react'
22
import { formatBytes } from 'lib/format'
33
import { newWindow } from 'lib/window'
4-
import { useSocket, useEventListener } from 'components/socket'
4+
import { useSocket, useEventListener } from 'lib/socket'
55
import Loader from 'components/loader'
66
import Panel from 'components/panel'
77
import packageJson from '../../../package.json'
8.87 KB
Binary file not shown.

0 commit comments

Comments
 (0)