Skip to content

Commit 44ca010

Browse files
committed
promo.tsx
1 parent 8bd76a8 commit 44ca010

File tree

3 files changed

+37
-0
lines changed

3 files changed

+37
-0
lines changed

src/Promo.tsx

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
import type { FunctionComponent } from 'preact';
2+
3+
const dayLeftString = (days: number): string => {
4+
if (days === 0) {
5+
return 'Less than a day left!';
6+
} else if (days === 1) {
7+
return 'Just one day left!';
8+
} else {
9+
return `Just ${days} days left!`;
10+
}
11+
};
12+
13+
const Promo: FunctionComponent = () => {
14+
const now = Date.now();
15+
const daysLeft = Math.floor((1752735600000 - now) / (86400 * 1000));
16+
if (daysLeft < 0) {
17+
return null;
18+
} else {
19+
return (
20+
<p class="votenote">
21+
<strong>{dayLeftString(daysLeft)}</strong> Please consider{' '}
22+
<a target="_blank" href="https://www.youtube.com/shorts/4h8mYt6qnlw">
23+
voting for Jaspinko in the GeoGuessr Remix challenge
24+
</a>
25+
!
26+
</p>
27+
);
28+
}
29+
};
30+
31+
export default Promo;

src/index.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,15 @@ import { render } from 'preact';
99
import About from './About';
1010
import Data from './Data';
1111
import Game from './Game';
12+
import Promo from './Promo';
1213
import Providers from './Providers';
1314
import Results from './Results';
1415
import './style.css';
1516

1617
const App = () => (
1718
<Providers>
1819
<h1>tpg solver</h1>
20+
<Promo />
1921
<Game />
2022
<Data />
2123
<Results />

src/style.css

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -207,3 +207,7 @@ a:any-link {
207207
text-decoration: underline;
208208
cursor: pointer;
209209
}
210+
211+
.votenote {
212+
color: var(--error-color);
213+
}

0 commit comments

Comments
 (0)