Skip to content

Commit a5052d5

Browse files
committed
fix: workflows
1 parent 2fedff4 commit a5052d5

3 files changed

Lines changed: 45 additions & 7 deletions

File tree

.gitignore

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
# Logs
21
logs
32
*.log
43
npm-debug.log*
@@ -12,15 +11,15 @@ lerna-debug.log*
1211
!.env.vite.production
1312
!.env.vite.canary
1413
!.env.vite.development
15-
scripts
14+
/scripts/*
15+
!/scripts/verify-node-modules.mjs
1616
node_modules
1717
dist
1818
dist-ssr
1919
*.local
2020

2121
.vite
2222

23-
# Editor directories and files
2423
.vscode/*
2524
!.vscode/extensions.json
2625
.idea

scripts/verify-node-modules.mjs

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
import { existsSync, readFileSync } from 'node:fs'
2+
import { fileURLToPath } from 'node:url'
3+
import { dirname, join } from 'node:path'
4+
5+
const root = join(dirname(fileURLToPath(import.meta.url)), '..')
6+
const nm = join(root, 'node_modules')
7+
8+
if (!existsSync(nm)) {
9+
console.error('verify-node-modules: node_modules directory not found.')
10+
process.exit(1)
11+
}
12+
13+
const pkg = JSON.parse(readFileSync(join(root, 'package.json'), 'utf8'))
14+
const deps = {
15+
...pkg.dependencies,
16+
...pkg.devDependencies,
17+
...(pkg.optionalDependencies ?? {}),
18+
}
19+
20+
for (const name of Object.keys(deps)) {
21+
const segments = name.split('/')
22+
const pkgDir =
23+
name.startsWith('@') && segments.length >= 2
24+
? join(nm, segments[0], segments[1])
25+
: join(nm, name)
26+
if (!existsSync(pkgDir)) {
27+
console.error(
28+
`verify-node-modules: missing installed package "${name}" (expected ${pkgDir})`,
29+
)
30+
process.exit(1)
31+
}
32+
}

src/pages/Submit.tsx

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,7 @@ export default function Submit() {
9999
if (
100100
success &&
101101
submittedFlight &&
102+
user &&
102103
session?.isPFATC &&
103104
(settings?.acars?.autoRedirectToAcars ?? true)
104105
) {
@@ -109,6 +110,7 @@ export default function Submit() {
109110
}, [
110111
success,
111112
submittedFlight,
113+
user,
112114
session?.isPFATC,
113115
settings?.acars?.autoRedirectToAcars,
114116
sessionId,
@@ -540,13 +542,18 @@ export default function Submit() {
540542
<Button
541543
onClick={() => {
542544
setShowRating(false);
543-
navigate(
544-
`/acars/${sessionId}/${submittedFlight.id}?acars_token=${submittedFlight.acars_token}`
545-
);
545+
const acarsPath = `/acars/${sessionId}/${submittedFlight.id}?acars_token=${submittedFlight.acars_token}`;
546+
if (user) {
547+
navigate(acarsPath);
548+
} else {
549+
window.location.href = getDiscordLoginUrl(acarsPath);
550+
}
546551
}}
547552
>
548553
<TowerControl className="h-5 w-5 mr-2" />
549-
Go to ACARS
554+
{user
555+
? 'Go to ACARS'
556+
: 'Log in to access ACARS and PDCs'}
550557
</Button>
551558
)}
552559
<Button onClick={handleCreateAnother} variant="outline">

0 commit comments

Comments
 (0)