Skip to content

Commit 2a985b6

Browse files
committed
Merge branch 'feat/air-codes' into chore/all-my-stuffs
# Conflicts: # components.d.ts # package.json # pnpm-lock.yaml # src/tools/index.ts
2 parents 9ae4574 + 071cd4c commit 2a985b6

File tree

5 files changed

+93
-1
lines changed

5 files changed

+93
-1
lines changed

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,7 @@
104104
"@zxing/library": "^0.21.0",
105105
"arr-diff": "^4.0.0",
106106
"@xmldom/xmldom": "^0.8.10",
107+
"aircodes": "^1.3.16",
107108
"bcryptjs": "^2.4.3",
108109
"big.js": "^6.2.2",
109110
"change-case": "^4.1.2",

pnpm-lock.yaml

Lines changed: 9 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/tools/air-codes/air-codes.vue

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
<script setup lang="ts">
2+
import { findAirline, findAirport } from 'aircodes';
3+
import SpanCopyable from '@/components/SpanCopyable.vue';
4+
5+
const airlineQuery = ref('');
6+
const airportQuery = ref('');
7+
const resultAirline = computed(() => airlineQuery.value === '' ? [] : findAirline(airlineQuery.value));
8+
const resultAirport = computed(() => airportQuery.value === '' ? [] : findAirport(airportQuery.value));
9+
</script>
10+
11+
<template>
12+
<div>
13+
<c-card title="Airline search" mb-1>
14+
<n-space>
15+
<n-form-item label="Airline query">
16+
<n-input v-model:value="airlineQuery" />
17+
</n-form-item>
18+
</n-space>
19+
20+
<n-divider />
21+
22+
<div v-for="airline in resultAirline" :key="airline.iata">
23+
<n-form-item label="IATA">
24+
<SpanCopyable :value="airline.iata" />
25+
</n-form-item>
26+
<n-form-item label="ICAO">
27+
<SpanCopyable :value="airline.icao" />
28+
</n-form-item>
29+
<n-form-item label="Name">
30+
<SpanCopyable :value="airline.name" />
31+
</n-form-item>
32+
<n-form-item label="Logo">
33+
<img width="100" :alt="airline.name" :src="airline.logo">
34+
</n-form-item>
35+
</div>
36+
</c-card>
37+
38+
<c-card title="Airport search">
39+
<n-space>
40+
<n-form-item label="Airport query">
41+
<n-input v-model:value="airportQuery" />
42+
</n-form-item>
43+
</n-space>
44+
45+
<n-divider />
46+
47+
<div v-for="airport in resultAirport" :key="airport.iata">
48+
<n-form-item label="IATA">
49+
<SpanCopyable :value="airport.iata" />
50+
</n-form-item>
51+
<n-form-item label="ICAO">
52+
<SpanCopyable :value="airport.icao" />
53+
</n-form-item>
54+
<n-form-item label="Name">
55+
<SpanCopyable :value="airport.name" />
56+
</n-form-item>
57+
<n-form-item label="City">
58+
<SpanCopyable :value="airport.city" />
59+
</n-form-item>
60+
<n-form-item label="State">
61+
<SpanCopyable :value="airport.state" />
62+
</n-form-item>
63+
<n-form-item label="Country">
64+
<SpanCopyable :value="airport.country" />
65+
</n-form-item>
66+
</div>
67+
</c-card>
68+
</div>
69+
</template>

src/tools/air-codes/index.ts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
import { Plane } from '@vicons/tabler';
2+
import { defineTool } from '../tool';
3+
4+
export const tool = defineTool({
5+
name: 'Air Codes',
6+
path: '/air-codes',
7+
description: 'Get Airport and Airline info from name, ICAO code or IATA code',
8+
keywords: ['airport', 'airline', 'air', 'plane', 'icao', 'iata'],
9+
component: () => import('./air-codes.vue'),
10+
icon: Plane,
11+
createdAt: new Date('2024-04-20'),
12+
});

src/tools/index.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,7 @@ import { tool as ulidGenerator } from './ulid-generator';
108108
import { tool as ibanValidatorAndParser } from './iban-validator-and-parser';
109109
import { tool as stringObfuscator } from './string-obfuscator';
110110
import { tool as textDiff } from './text-diff';
111+
import { tool as airCodes } from './air-codes';
111112
import { tool as emojiPicker } from './emoji-picker';
112113
import { tool as passwordStrengthAnalyser } from './password-strength-analyser';
113114
import { tool as yamlToToml } from './yaml-to-toml';
@@ -446,6 +447,7 @@ export const toolsByCategory: ToolCategory[] = [
446447
ibanValidatorAndParser,
447448
luhnValidator,
448449
vatValidator,
450+
airCodes,
449451
],
450452
},
451453
];

0 commit comments

Comments
 (0)