Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# Logs
logs
*.log
npm-debug.log*
Expand All @@ -12,15 +11,15 @@ lerna-debug.log*
!.env.vite.production
!.env.vite.canary
!.env.vite.development
scripts
/scripts/*
!/scripts/verify-node-modules.mjs
node_modules
dist
dist-ssr
*.local

.vite

# Editor directories and files
.vscode/*
!.vscode/extensions.json
.idea
Expand Down
32 changes: 32 additions & 0 deletions scripts/verify-node-modules.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
import { existsSync, readFileSync } from 'node:fs'
import { fileURLToPath } from 'node:url'
import { dirname, join } from 'node:path'

const root = join(dirname(fileURLToPath(import.meta.url)), '..')
const nm = join(root, 'node_modules')

if (!existsSync(nm)) {
console.error('verify-node-modules: node_modules directory not found.')
process.exit(1)
}

const pkg = JSON.parse(readFileSync(join(root, 'package.json'), 'utf8'))
const deps = {
...pkg.dependencies,
...pkg.devDependencies,
...(pkg.optionalDependencies ?? {}),
}

for (const name of Object.keys(deps)) {
const segments = name.split('/')
const pkgDir =
name.startsWith('@') && segments.length >= 2
? join(nm, segments[0], segments[1])
: join(nm, name)
if (!existsSync(pkgDir)) {
console.error(
`verify-node-modules: missing installed package "${name}" (expected ${pkgDir})`,
)
process.exit(1)
}
}
15 changes: 11 additions & 4 deletions src/pages/Submit.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@ export default function Submit() {
if (
success &&
submittedFlight &&
user &&
session?.isPFATC &&
(settings?.acars?.autoRedirectToAcars ?? true)
) {
Expand All @@ -109,6 +110,7 @@ export default function Submit() {
}, [
success,
submittedFlight,
user,
session?.isPFATC,
settings?.acars?.autoRedirectToAcars,
sessionId,
Expand Down Expand Up @@ -540,13 +542,18 @@ export default function Submit() {
<Button
onClick={() => {
setShowRating(false);
navigate(
`/acars/${sessionId}/${submittedFlight.id}?acars_token=${submittedFlight.acars_token}`
);
const acarsPath = `/acars/${sessionId}/${submittedFlight.id}?acars_token=${submittedFlight.acars_token}`;
if (user) {
navigate(acarsPath);
} else {
window.location.href = getDiscordLoginUrl(acarsPath);
}
}}
>
<TowerControl className="h-5 w-5 mr-2" />
Go to ACARS
{user
? 'Go to ACARS'
: 'Log in to access ACARS and PDCs'}
</Button>
)}
<Button onClick={handleCreateAnother} variant="outline">
Expand Down
Loading