Skip to content

Commit 673deef

Browse files
Merge pull request #52 from sebastiankrll/ui/web
UI/web
2 parents 3e112cf + aa81915 commit 673deef

File tree

98 files changed

+3154
-1267
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

98 files changed

+3154
-1267
lines changed

.gitattributes

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
# Auto detect text files and perform LF normalization
2-
* text=auto
2+
* text=auto eol=lf

apps/ingestion/src/pilot.ts

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,6 @@ export async function mapPilots(latestVatsimData: VatsimData): Promise<[PilotLon
124124
pilot_rating: PILOT_RATINGS.find((r) => r.id === pilot.pilot_rating)?.short_name || "NEW",
125125
military_rating: MILITARY_RATINGS.find((r) => r.id === pilot.military_rating)?.short_name || "M0",
126126
flight_plan: await mapPilotFlightPlan(pilot.flight_plan),
127-
route: `${pilot.flight_plan?.departure || "N/A"} -- ${pilot.flight_plan?.arrival || "N/A"}`,
128127
logon_time: new Date(pilot.logon_time),
129128
times: null,
130129
live: true,
@@ -191,19 +190,20 @@ export function getPilotShort(p: PilotLong, c?: PilotLong): PilotShort {
191190
if (!c) {
192191
return {
193192
id: p.id,
193+
callsign: p.callsign,
194194
latitude: p.latitude,
195195
longitude: p.longitude,
196196
altitude_agl: p.altitude_agl,
197197
altitude_ms: p.altitude_ms,
198198
groundspeed: p.groundspeed,
199199
vertical_speed: p.vertical_speed,
200200
heading: p.heading,
201-
callsign: p.callsign,
202201
aircraft: p.aircraft,
203202
transponder: p.transponder,
204203
frequency: p.frequency,
205-
route: p.route,
206-
ghost: p.ghost,
204+
route: `${p.flight_plan?.departure.icao || "N/A"} -- ${p.flight_plan?.arrival.icao || "N/A"}`,
205+
flight_rules: p.flight_plan?.flight_rules || "IFR",
206+
ac_reg: p.flight_plan?.ac_reg || null,
207207
};
208208
} else {
209209
const pilotShort: PilotShort = { id: p.id };
@@ -219,8 +219,11 @@ export function getPilotShort(p: PilotLong, c?: PilotLong): PilotShort {
219219
if (p.aircraft !== c.aircraft) pilotShort.aircraft = p.aircraft;
220220
if (p.transponder !== c.transponder) pilotShort.transponder = p.transponder;
221221
if (p.frequency !== c.frequency) pilotShort.frequency = p.frequency;
222-
if (p.route !== c.route) pilotShort.route = p.route;
223-
if (p.ghost !== c.ghost) pilotShort.ghost = p.ghost;
222+
if (p.flight_plan?.departure.icao !== c.flight_plan?.departure.icao || p.flight_plan?.arrival.icao !== c.flight_plan?.arrival.icao) {
223+
pilotShort.route = `${p.flight_plan?.departure.icao || "N/A"} -- ${p.flight_plan?.arrival.icao || "N/A"}`;
224+
}
225+
if (p.flight_plan?.flight_rules !== c.flight_plan?.flight_rules) pilotShort.flight_rules = p.flight_plan?.flight_rules || "IFR";
226+
if (p.flight_plan?.ac_reg !== c.flight_plan?.ac_reg) pilotShort.ac_reg = p.flight_plan?.ac_reg || null;
224227

225228
return pilotShort;
226229
}

apps/updater/src/aircrafts.ts

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
import { rdsGetSingle, rdsSetSingle } from "@sr24/db/redis";
2+
import axios from "axios";
3+
4+
const RELEASE_URL = "https://api.github.com/repos/sebastiankrll/simradar21-data/releases/latest";
5+
const BASE_DATA_URL = "https://github.com/sebastiankrll/simradar21-data/releases/download/";
6+
7+
let version: string | null = null;
8+
let release: string | null = null;
9+
10+
export async function updateAircrafts(): Promise<void> {
11+
if (!version) {
12+
await initVersion();
13+
}
14+
if (!(await isNewRelease())) return;
15+
16+
try {
17+
const aircraftsJsonUrl = `${BASE_DATA_URL}${release}/aircrafts.json`;
18+
19+
const response = await axios.get(aircraftsJsonUrl, {
20+
responseType: "json",
21+
});
22+
23+
await rdsSetSingle("static_aircrafts:all", response.data);
24+
await rdsSetSingle("static_aircrafts:version", version || "1.0.0");
25+
26+
console.log(`✅ Aircrafts data updated to version ${version}`);
27+
} catch (error) {
28+
console.error(`Error checking for new aircrafts data: ${error}`);
29+
}
30+
}
31+
32+
async function initVersion(): Promise<void> {
33+
if (!version) {
34+
const redisVersion = await rdsGetSingle("static_aircrafts:version");
35+
version = redisVersion || "0.0.0";
36+
}
37+
}
38+
39+
async function isNewRelease(): Promise<boolean> {
40+
try {
41+
const releaseResponse = await axios.get(RELEASE_URL);
42+
release = releaseResponse.data.tag_name;
43+
44+
const versionsResponse = await axios.get(`${BASE_DATA_URL}${release}/versions.json`, {
45+
responseType: "json",
46+
});
47+
const latestVersion = versionsResponse.data.aircrafts;
48+
49+
if (latestVersion !== version) {
50+
version = latestVersion;
51+
return true;
52+
}
53+
} catch (error) {
54+
console.error(`Error checking for updates: ${error}`);
55+
}
56+
57+
return false;
58+
}

apps/updater/src/airlines.ts

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ const RELEASE_URL = "https://api.github.com/repos/sebastiankrll/simradar21-data/
55
const BASE_DATA_URL = "https://github.com/sebastiankrll/simradar21-data/releases/download/";
66

77
let version: string | null = null;
8+
let release: string | null = null;
89

910
export async function updateAirlines(): Promise<void> {
1011
if (!version) {
@@ -13,7 +14,7 @@ export async function updateAirlines(): Promise<void> {
1314
if (!(await isNewRelease())) return;
1415

1516
try {
16-
const airlinesJsonUrl = `${BASE_DATA_URL}${version}/airlines.json`;
17+
const airlinesJsonUrl = `${BASE_DATA_URL}${release}/airlines.json`;
1718

1819
const response = await axios.get(airlinesJsonUrl, {
1920
responseType: "json",
@@ -37,11 +38,16 @@ async function initVersion(): Promise<void> {
3738

3839
async function isNewRelease(): Promise<boolean> {
3940
try {
40-
const response = await axios.get(RELEASE_URL);
41-
const release = response.data.tag_name;
41+
const releaseResponse = await axios.get(RELEASE_URL);
42+
release = releaseResponse.data.tag_name;
4243

43-
if (release !== version) {
44-
version = release;
44+
const versionsResponse = await axios.get(`${BASE_DATA_URL}${release}/versions.json`, {
45+
responseType: "json",
46+
});
47+
const latestVersion = versionsResponse.data.airlines;
48+
49+
if (latestVersion !== version) {
50+
version = latestVersion;
4551
return true;
4652
}
4753
} catch (error) {

apps/updater/src/fleet.ts

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ const RELEASE_URL = "https://api.github.com/repos/sebastiankrll/simradar21-data/
1010
const BASE_DATA_URL = "https://github.com/sebastiankrll/simradar21-data/releases/download/";
1111

1212
let version: string | null = null;
13+
let release: string | null = null;
1314

1415
export async function updateFleets(): Promise<void> {
1516
if (!version) {
@@ -18,7 +19,7 @@ export async function updateFleets(): Promise<void> {
1819
if (!(await isNewRelease())) return;
1920

2021
try {
21-
const fleetsJsonUrl = `${BASE_DATA_URL}${version}/fleets.json`;
22+
const fleetsJsonUrl = `${BASE_DATA_URL}${release}/fleets.json`;
2223
const response = await fetch(fleetsJsonUrl);
2324

2425
if (!response.body) {
@@ -61,11 +62,16 @@ async function initVersion(): Promise<void> {
6162

6263
async function isNewRelease(): Promise<boolean> {
6364
try {
64-
const response = await axios.get(RELEASE_URL);
65-
const release = response.data.tag_name;
65+
const releaseResponse = await axios.get(RELEASE_URL);
66+
release = releaseResponse.data.tag_name;
6667

67-
if (release !== version) {
68-
version = release;
68+
const versionsResponse = await axios.get(`${BASE_DATA_URL}${release}/versions.json`, {
69+
responseType: "json",
70+
});
71+
const latestVersion = versionsResponse.data.fleets;
72+
73+
if (latestVersion !== version) {
74+
version = latestVersion;
6975
return true;
7076
}
7177
} catch (error) {

apps/updater/src/index.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import "dotenv/config";
22
import { rdsConnect } from "@sr24/db/redis";
33
import { CronJob } from "cron";
4+
import { updateAircrafts } from "./aircrafts.js";
45
import { updateAirlines } from "./airlines.js";
56
import { updateAirports } from "./airports.js";
67
import { updateFirs } from "./fir.js";
@@ -19,6 +20,7 @@ CronJob.from({
1920
}
2021

2122
await updateAirlines();
23+
await updateAircrafts();
2224
await updateAirports();
2325
await updateFirs();
2426
await updateTracons();

apps/updater/src/s3.ts

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,22 +18,30 @@ export async function updateR2Storage(): Promise<void> {
1818
"static_firs:version",
1919
"static_tracons:version",
2020
"static_airlines:version",
21+
"static_aircrafts:version",
2122
]);
2223
const manifest = {
2324
airportsVersion: versions[0],
2425
firsVersion: versions[1],
2526
traconsVersion: versions[2],
2627
airlinesVersion: versions[3],
28+
aircraftsVersion: versions[4],
2729
};
2830

2931
await uploadManifestToR2(manifest);
3032

31-
const datas = await rdsGetMultiple("", ["static_airports:all", "static_firs:all", "static_tracons:all", "static_airlines:all"]);
33+
const datas = await rdsGetMultiple("", [
34+
"static_airports:all",
35+
"static_firs:all",
36+
"static_tracons:all",
37+
"static_airlines:all",
38+
"static_aircrafts:all",
39+
]);
3240
await uploadDataToR2(`airports_${manifest.airportsVersion}.json`, JSON.stringify(datas[0]));
3341
await uploadDataToR2(`firs_${manifest.firsVersion}.json`, JSON.stringify(datas[1]));
3442
await uploadDataToR2(`tracons_${manifest.traconsVersion}.json`, JSON.stringify(datas[2]));
3543
await uploadDataToR2(`airlines_${manifest.airlinesVersion}.json`, JSON.stringify(datas[3]));
36-
44+
await uploadDataToR2(`aircrafts_${manifest.aircraftsVersion}.json`, JSON.stringify(datas[4]));
3745
console.log("✅ R2 storage update completed!");
3846
}
3947

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
import FiltersPanel from "@/components/Panels/Filters/FiltersPanel";
2+
3+
export default function Page() {
4+
return <FiltersPanel />;
5+
}

apps/web/app/globals.css

Lines changed: 36 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ html {
44
margin: 0;
55
padding: 0;
66
font-optical-sizing: auto;
7-
font-weight: 500;
7+
font-weight: var(--font-weight-normal);
88
font-style: normal;
99
color: var(--color-main-text);
1010
font-family: inherit;
@@ -23,28 +23,33 @@ html {
2323
--color-main-text: rgb(77, 95, 131);
2424
--color-light-text: rgb(183, 190, 206);
2525
--color-light-grey: rgb(246, 248, 253);
26-
--color-dark-grey: rgb(223, 227, 235);
27-
--color-border: rgb(211, 214, 228);
26+
--color-dark-grey: rgb(214, 218, 226);
27+
--color-border: rgb(189, 193, 206);
2828
--color-box-shadow: rgb(193, 194, 202);
29-
--color-blue: rgb(60, 92, 255);
30-
--color-light-blue: #3cb1ff;
31-
--color-green: #0bd3a7;
29+
--color-blue: #2f4de4;
30+
--color-green: #11b18f;
3231
--color-red: #ea5979;
3332
--color-yellow: rgb(255, 244, 43);
3433
--color-orange: #ff8a2b;
3534
--color-magenta: rgb(222, 89, 234);
3635
--color-glass-bg: rgba(255, 255, 255, 0.5);
3736
--color-hover: rgb(77, 95, 131);
37+
3838
--box-shadow: 1px 1px 5px 1px var(--color-box-shadow);
39+
40+
--font-weight-bold: 700;
41+
--font-weight-normal: 400;
42+
--font-size-normal: 14px;
43+
--font-size-small: 12px;
3944
}
4045

4146
[data-theme="dark"] {
4247
--color-bg: rgb(21, 27, 39);
4348
--color-main-text: rgb(221, 225, 235);
44-
--color-dark-grey: rgb(46, 52, 66);
45-
--color-light-grey: rgb(46, 52, 66);
49+
--color-dark-grey: rgb(56, 64, 82);
50+
--color-light-grey: rgb(37, 43, 54);
4651
--color-border: rgb(113, 121, 153);
47-
--color-box-shadow: rgb(59, 61, 70);
52+
--color-box-shadow: rgb(39, 40, 46);
4853
--color-glass-bg: rgba(80, 80, 80, 0.3);
4954
--color-hover: rgb(105, 124, 165);
5055
}
@@ -70,3 +75,25 @@ section {
7075
padding: 5.5rem 2rem 3.5rem 2rem;
7176
flex: 1;
7277
}
78+
79+
select {
80+
font-family: inherit;
81+
font-size: var(--font-size-normal);
82+
color: inherit;
83+
background-color: var(--color-dark-grey);
84+
border: 1px solid transparent;
85+
}
86+
87+
select:focus {
88+
outline: none;
89+
border-color: var(--color-border);
90+
}
91+
92+
select option:checked {
93+
background: var(--color-hover);
94+
color: white;
95+
}
96+
97+
select option:hover {
98+
background: var(--color-hover);
99+
}

apps/web/app/layout.tsx

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,19 @@
11
import type { Metadata } from "next";
2-
import { Manrope } from "next/font/google";
2+
import { Ubuntu } from "next/font/google";
33
import "./globals.css";
44
import "@/assets/images/sprites/freakflags.css";
5-
import Footer from "@/components/Footer/Footer";
6-
import Header from "@/components/Header/Header";
5+
import Footer from "@/components/shared/Footer/Footer";
6+
import Header from "@/components/shared/Header/Header";
77
import { Providers } from "./providers";
88

99
export const metadata: Metadata = {
1010
title: "simradar21",
1111
description: "VATSIM tracking service",
1212
};
1313

14-
const manrope = Manrope({
14+
const ubuntu = Ubuntu({
1515
subsets: ["latin"],
16+
weight: ["300", "400", "500", "700"],
1617
display: "swap",
1718
});
1819

@@ -22,7 +23,7 @@ export default function RootLayout({
2223
children: React.ReactNode;
2324
}>) {
2425
return (
25-
<html lang="en" className={manrope.className} suppressHydrationWarning>
26+
<html lang="en" className={ubuntu.className} suppressHydrationWarning>
2627
<body>
2728
<Providers>
2829
<Header />

0 commit comments

Comments
 (0)