Skip to content

Commit 2692c88

Browse files
authored
New omnibar design (#14)
* First start on omnibar v2 * Animations went bork * Fix animations * Leaving animations for what they are now * Arrows are getting better * Better styling * Improve display of milestones * Update some fonts * Some tracker fixes * AAAAAAAAAAAAAAAA * Improve handling of tracker urls * Cleanup * More cleanup
1 parent be31057 commit 2692c88

31 files changed

+281
-188
lines changed
Binary file not shown.

src/extension/omnibar.ts

+6-6
Original file line numberDiff line numberDiff line change
@@ -109,11 +109,11 @@ async function showNext(): Promise<void> {
109109
nodecg().log.debug('[Omnibar] Pin available, will show:', pin.type);
110110
const dashConfig = pin.type === 'Bid' ? {
111111
text: (item as Bids[0]).war ? 'Upcoming Bid War' : 'Upcoming Goal',
112-
fontSize: 25,
112+
fontSize: 34,
113113
top: 6,
114114
} : {
115115
text: 'Upcoming Milestone',
116-
fontSize: 25,
116+
fontSize: 34,
117117
top: 6,
118118
};
119119

@@ -184,8 +184,8 @@ async function showNext(): Promise<void> {
184184
run,
185185
dash: {
186186
text: 'Up next',
187-
top: 20,
188-
fontSize: 37,
187+
top: 13,
188+
fontSize: 50,
189189
},
190190
},
191191
};
@@ -201,7 +201,7 @@ async function showNext(): Promise<void> {
201201
milestone,
202202
dash: {
203203
text: 'Upcoming Milestone',
204-
fontSize: 25,
204+
fontSize: 34,
205205
top: 6,
206206
},
207207
},
@@ -215,7 +215,7 @@ async function showNext(): Promise<void> {
215215
bid,
216216
dash: {
217217
text: bid.war ? 'Upcoming Bid War' : 'Upcoming Goal',
218-
fontSize: 25,
218+
fontSize: 34,
219219
top: 6,
220220
},
221221
},

src/extension/tracker/bids.ts

+5-3
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,11 @@ import needle from 'needle';
33
import { eventInfo, getCookies } from '.';
44
import { get as nodecg } from '../util/nodecg';
55
import { bids } from '../util/replicants';
6+
import utils from './utils';
7+
8+
const { trackerUrl } = utils;
69

710
const eventConfig = nodecg().bundleConfig.event;
8-
const config = nodecg().bundleConfig.tracker;
911
const { useTestData } = nodecg().bundleConfig;
1012
const refreshTime = 30 * 1000; // Get bids every 30s.
1113

@@ -95,8 +97,8 @@ async function updateBids(): Promise<void> {
9597
try {
9698
const resp = await needle(
9799
'get',
98-
`https://${config.address}/search/?event=${eventInfo[eventConfig.thisEvent - 1].id}`
99-
+ '&type=allbids&state=OPENED',
100+
trackerUrl(`/search/?event=${eventInfo[eventConfig.thisEvent - 1].id}`
101+
+ '&type=allbids&state=OPENED'),
100102
{
101103
cookies: getCookies(),
102104
},

src/extension/tracker/donations.ts

+7-5
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,11 @@ import needle from 'needle';
33
import { get as nodecg } from '../util/nodecg';
44
import { donationsToRead } from '../util/replicants';
55
import { eventInfo, getCookies } from './index';
6+
import utils from './utils';
7+
8+
const { trackerUrl } = utils;
69

710
const eventConfig = nodecg().bundleConfig.event;
8-
const config = nodecg().bundleConfig.tracker;
911
const { useTestData } = nodecg().bundleConfig;
1012
const refreshTime = 10 * 1000; // Get donations every 10s.
1113
let updateTimeout: NodeJS.Timeout;
@@ -34,8 +36,8 @@ async function updateToReadDonations(): Promise<void> {
3436
try {
3537
const resp = await needle(
3638
'get',
37-
`https://${config.address}/search/?event=${eventInfo[eventConfig.thisEvent - 1].id}`
38-
+ '&type=donation&feed=toread',
39+
trackerUrl(`/search/?event=${eventInfo[eventConfig.thisEvent - 1].id}`
40+
+ '&type=donation&feed=toread'),
3941
{
4042
cookies: getCookies(),
4143
},
@@ -71,8 +73,8 @@ export async function markDonationAsRead(donationID: number): Promise<void> {
7173
try {
7274
const resp = await needle(
7375
'get',
74-
`https://${config.address}/edit/?type=donation&id=${donationID}`
75-
+ '&readstate=READ&commentstate=APPROVED',
76+
trackerUrl(`/edit/?type=donation&id=${donationID}`
77+
+ '&readstate=READ&commentstate=APPROVED'),
7678
{
7779
cookies: getCookies(),
7880
},

src/extension/tracker/index.ts

+5-2
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,9 @@ import type { DeepWritable } from 'ts-essentials';
88
import { get as nodecg } from '../util/nodecg';
99
import { mq } from '../util/rabbitmq';
1010
import { donationTotal } from '../util/replicants';
11+
import utils from './utils';
12+
13+
const { trackerUrl } = utils;
1114

1215
export const eventInfo: Tracker.EventInfo[] = [];
1316
const eventConfig = nodecg().bundleConfig.event;
@@ -31,7 +34,7 @@ export function getCookies(): NeedleResponse['cookies'] {
3134
async function getEventIDFromShort(short: string): Promise<number> {
3235
const resp = await needle(
3336
'get',
34-
`https://${config.address}/search/?short=${short}&type=event`,
37+
trackerUrl(`/search/?short=${short}&type=event`),
3538
cookies,
3639
);
3740
if (!resp.body.length) {
@@ -47,7 +50,7 @@ async function updateDonationTotalFromAPI(init = false): Promise<void> {
4750
try {
4851
let total = 0;
4952
for (const event of eventInfo) {
50-
const resp = await needle('get', `https://${config.address}/event/${event.id}?json`);
53+
const resp = await needle('get', trackerUrl(`/event/${event.short}?json`));
5154
if (resp.statusCode === 200) {
5255
const eventTotal = resp.body.agg.amount ? parseFloat(resp.body.agg.amount) : 0;
5356
event.total = eventTotal;

src/extension/tracker/prizes.ts

+4-2
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,10 @@ import needle from 'needle';
33
import { eventInfo, getCookies } from '.';
44
import { get as nodecg } from '../util/nodecg';
55
import { prizes } from '../util/replicants';
6+
import utils from './utils';
7+
8+
const { trackerUrl } = utils;
69

7-
const config = nodecg().bundleConfig.tracker;
810
const { useTestData } = nodecg().bundleConfig;
911
const refreshTime = 60 * 1000; // Get prizes every 60s.
1012

@@ -31,7 +33,7 @@ async function updatePrizes(): Promise<void> {
3133
try {
3234
const resp = await needle(
3335
'get',
34-
`https://${config.address}/search/?event=${eventInfo[0].id}&type=prize&feed=current`,
36+
trackerUrl(`/search/?event=${eventInfo[0].id}&type=prize&feed=current`),
3537
{
3638
cookies: getCookies(),
3739
},

src/extension/tracker/utils.ts

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
import { get as nodecg } from '@esa-layouts/util/nodecg';
2+
3+
const config = nodecg().bundleConfig.tracker;
4+
5+
function trackerUrl(path: string): string {
6+
return `https://${config.address}/tracker${path}`;
7+
}
8+
9+
export default {
10+
trackerUrl,
11+
};

src/graphics/_misc/themes/bsg.theme.css

+1-2
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,9 @@
22
--bsg-color: #cf773b;
33
--slide-color: #914e21;
44
--text-color: white;
5+
--main-bg-color: #404040;
56
--bg-start: #303030;
67
--bg-end: #212121;
7-
8-
--dash-left-width: 194px;
98
}
109

1110
/* TODO: scss */

src/graphics/omnibar/components/Clock.vue

+27-12
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,12 @@
22
<div
33
class="Clock"
44
:style="{
5-
width: '90px',
6-
'font-size': '35px',
5+
width: '100%',
6+
height: '100%',
77
}"
88
>
9-
{{ time }}
9+
<span>{{ time }}</span>
10+
<span>{{ date }}</span>
1011
</div>
1112
</template>
1213

@@ -20,9 +21,13 @@ dayjs.extend(timezone);
2021
@Component
2122
export default class extends Vue {
2223
time = '00:00';
24+
date = '00/00/0000';
2325
2426
setTime(): void {
25-
this.time = dayjs().tz('Europe/Amsterdam').format('HH:mm');
27+
const timer = dayjs().tz('Europe/Amsterdam');
28+
29+
this.time = timer.format('HH:mm').trim();
30+
this.date = timer.format('DD/MM/YYYY').trim();
2631
}
2732
2833
created(): void {
@@ -32,14 +37,24 @@ export default class extends Vue {
3237
}
3338
</script>
3439

35-
<!-- TODO: move this to correct style sheet -->
36-
<style scoped>
40+
<style scoped lang="scss">
3741
.Clock {
38-
flex-shrink: 3;
39-
font-size: 35px;
40-
/*width: 90px;*/
41-
padding-left: 30px;
42-
padding-top: 19px;
43-
font-family: 'Goodlight'
42+
font-variant-numeric: tabular-nums;
43+
position: relative;
44+
left: -15px;
45+
text-align: center;
46+
padding-top: 2px;
47+
display: flex;
48+
flex-direction: column;
49+
justify-content: center;
50+
font-family: 'Bahnschrift';
51+
52+
span:first-child {
53+
font-size: 40px;
54+
}
55+
56+
span:nth-child(2) {
57+
font-size: 20px;
58+
}
4459
}
4560
</style>

src/graphics/omnibar/components/Ticker.vue

+2-2
Original file line numberDiff line numberDiff line change
@@ -106,9 +106,9 @@ export default class extends Vue {
106106
min-width: 0;
107107
flex: 1;
108108
padding-top: 2px;
109-
margin-left: 12px;
109+
margin-left: 0px;
110110
align-items: center;
111-
font-family: 'Goodlight';
111+
font-family: 'Bahnschrift', sans-serif;
112112
}
113113
114114
.ticker-leave-active {

src/graphics/omnibar/components/Ticker/Milestone.vue

+1-11
Original file line numberDiff line numberDiff line change
@@ -7,22 +7,12 @@
77
'white-space': 'nowrap',
88
}"
99
>
10-
<!-- <div
11-
:style="{
12-
'font-size': '30px',
13-
'text-align': 'right',
14-
'margin-left': '15px',
15-
'line-height': '100%',
16-
}"
17-
>
18-
Upcoming<br>Milestone
19-
</div>-->
2010
<div
2111
:style="{
2212
position: 'relative',
2313
'flex-grow': 1,
2414
margin: '10px',
25-
height: '60px',
15+
height: '65px',
2616
'background-color': 'rgba(0, 0, 0, 0.3)',
2717
}"
2818
>

src/graphics/omnibar/components/Ticker/UpcomingRun.vue

+2-2
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,10 @@
1010
'align-items': 'flex-start',
1111
}"
1212
>
13-
<div :style="{ 'font-size': '20px' }">
13+
<div :style="{ 'font-size': '25px' }">
1414
{{ when }}
1515
</div>
16-
<div :style="{ 'font-size': '26px' }">
16+
<div :style="{ 'font-size': '40px' }">
1717
<span v-if="getRunTotalPlayers(run) > 0">
1818
{{ formPlayerNamesStr(run) }}
1919
play<span v-if="getRunTotalPlayers(run) === 1">s</span> {{ run.game }}

0 commit comments

Comments
 (0)