mirror of
https://github.com/CorentinTh/it-tools.git
synced 2025-04-20 14:56:17 -04:00
Merge ba2036043e
into 07eea0f484
This commit is contained in:
commit
1c6e9a466b
11 changed files with 6669 additions and 8083 deletions
8
components.d.ts
vendored
8
components.d.ts
vendored
|
@ -64,6 +64,7 @@ declare module '@vue/runtime-core' {
|
||||||
'CTextCopyable.demo': typeof import('./src/ui/c-text-copyable/c-text-copyable.demo.vue')['default']
|
'CTextCopyable.demo': typeof import('./src/ui/c-text-copyable/c-text-copyable.demo.vue')['default']
|
||||||
CTooltip: typeof import('./src/ui/c-tooltip/c-tooltip.vue')['default']
|
CTooltip: typeof import('./src/ui/c-tooltip/c-tooltip.vue')['default']
|
||||||
'CTooltip.demo': typeof import('./src/ui/c-tooltip/c-tooltip.demo.vue')['default']
|
'CTooltip.demo': typeof import('./src/ui/c-tooltip/c-tooltip.demo.vue')['default']
|
||||||
|
CurrencyConverter: typeof import('./src/tools/currency-converter/currency-converter.vue')['default']
|
||||||
DateTimeConverter: typeof import('./src/tools/date-time-converter/date-time-converter.vue')['default']
|
DateTimeConverter: typeof import('./src/tools/date-time-converter/date-time-converter.vue')['default']
|
||||||
'DemoHome.page': typeof import('./src/ui/demo/demo-home.page.vue')['default']
|
'DemoHome.page': typeof import('./src/ui/demo/demo-home.page.vue')['default']
|
||||||
DemoWrapper: typeof import('./src/ui/demo/demo-wrapper.vue')['default']
|
DemoWrapper: typeof import('./src/ui/demo/demo-wrapper.vue')['default']
|
||||||
|
@ -130,18 +131,21 @@ declare module '@vue/runtime-core' {
|
||||||
MetaTagGenerator: typeof import('./src/tools/meta-tag-generator/meta-tag-generator.vue')['default']
|
MetaTagGenerator: typeof import('./src/tools/meta-tag-generator/meta-tag-generator.vue')['default']
|
||||||
MimeTypes: typeof import('./src/tools/mime-types/mime-types.vue')['default']
|
MimeTypes: typeof import('./src/tools/mime-types/mime-types.vue')['default']
|
||||||
NavbarButtons: typeof import('./src/components/NavbarButtons.vue')['default']
|
NavbarButtons: typeof import('./src/components/NavbarButtons.vue')['default']
|
||||||
NCheckbox: typeof import('naive-ui')['NCheckbox']
|
|
||||||
NCollapseTransition: typeof import('naive-ui')['NCollapseTransition']
|
NCollapseTransition: typeof import('naive-ui')['NCollapseTransition']
|
||||||
NConfigProvider: typeof import('naive-ui')['NConfigProvider']
|
NConfigProvider: typeof import('naive-ui')['NConfigProvider']
|
||||||
|
NDatePicker: typeof import('naive-ui')['NDatePicker']
|
||||||
NDivider: typeof import('naive-ui')['NDivider']
|
NDivider: typeof import('naive-ui')['NDivider']
|
||||||
|
NDynamicInput: typeof import('naive-ui')['NDynamicInput']
|
||||||
NEllipsis: typeof import('naive-ui')['NEllipsis']
|
NEllipsis: typeof import('naive-ui')['NEllipsis']
|
||||||
|
NFormItem: typeof import('naive-ui')['NFormItem']
|
||||||
NH1: typeof import('naive-ui')['NH1']
|
NH1: typeof import('naive-ui')['NH1']
|
||||||
NH3: typeof import('naive-ui')['NH3']
|
NH3: typeof import('naive-ui')['NH3']
|
||||||
NIcon: typeof import('naive-ui')['NIcon']
|
NIcon: typeof import('naive-ui')['NIcon']
|
||||||
NLayout: typeof import('naive-ui')['NLayout']
|
NLayout: typeof import('naive-ui')['NLayout']
|
||||||
NLayoutSider: typeof import('naive-ui')['NLayoutSider']
|
NLayoutSider: typeof import('naive-ui')['NLayoutSider']
|
||||||
NMenu: typeof import('naive-ui')['NMenu']
|
NMenu: typeof import('naive-ui')['NMenu']
|
||||||
NSpace: typeof import('naive-ui')['NSpace']
|
NP: typeof import('naive-ui')['NP']
|
||||||
|
NSelect: typeof import('naive-ui')['NSelect']
|
||||||
NTable: typeof import('naive-ui')['NTable']
|
NTable: typeof import('naive-ui')['NTable']
|
||||||
NumeronymGenerator: typeof import('./src/tools/numeronym-generator/numeronym-generator.vue')['default']
|
NumeronymGenerator: typeof import('./src/tools/numeronym-generator/numeronym-generator.vue')['default']
|
||||||
OtpCodeGeneratorAndValidator: typeof import('./src/tools/otp-code-generator-and-validator/otp-code-generator-and-validator.vue')['default']
|
OtpCodeGeneratorAndValidator: typeof import('./src/tools/otp-code-generator-and-validator/otp-code-generator-and-validator.vue')['default']
|
||||||
|
|
|
@ -60,6 +60,8 @@
|
||||||
"cron-validator": "^1.3.1",
|
"cron-validator": "^1.3.1",
|
||||||
"cronstrue": "^2.26.0",
|
"cronstrue": "^2.26.0",
|
||||||
"crypto-js": "^4.1.1",
|
"crypto-js": "^4.1.1",
|
||||||
|
"currency-codes-ts": "^3.0.0",
|
||||||
|
"currency-exchanger-js": "^1.0.4",
|
||||||
"date-fns": "^2.29.3",
|
"date-fns": "^2.29.3",
|
||||||
"dompurify": "^3.0.6",
|
"dompurify": "^3.0.6",
|
||||||
"email-normalizer": "^1.0.0",
|
"email-normalizer": "^1.0.0",
|
||||||
|
|
14598
pnpm-lock.yaml
generated
14598
pnpm-lock.yaml
generated
File diff suppressed because it is too large
Load diff
|
@ -128,7 +128,7 @@ function activateOption(option: PaletteOption) {
|
||||||
<c-input-text ref="inputRef" v-model:value="searchPrompt" raw-text placeholder="Type to search a tool or a command..." autofocus clearable />
|
<c-input-text ref="inputRef" v-model:value="searchPrompt" raw-text placeholder="Type to search a tool or a command..." autofocus clearable />
|
||||||
|
|
||||||
<div v-for="(options, category) in filteredSearchResult" :key="category">
|
<div v-for="(options, category) in filteredSearchResult" :key="category">
|
||||||
<div ml-3 mt-3 text-sm font-bold text-primary op-60>
|
<div ml-3 mt-3 text-sm text-primary font-bold op-60>
|
||||||
{{ category }}
|
{{ category }}
|
||||||
</div>
|
</div>
|
||||||
<command-palette-option v-for="option in options" :key="option.name" :option="option" :selected="selectedOptionIndex === getOptionIndex(option)" @activated="activateOption" />
|
<command-palette-option v-for="option in options" :key="option.name" :option="option" :selected="selectedOptionIndex === getOptionIndex(option)" @activated="activateOption" />
|
||||||
|
|
119
src/tools/currency-converter/currency-converter.vue
Normal file
119
src/tools/currency-converter/currency-converter.vue
Normal file
|
@ -0,0 +1,119 @@
|
||||||
|
<script setup lang="ts">
|
||||||
|
import { code, countries, country } from 'currency-codes-ts';
|
||||||
|
import converter from 'currency-exchanger-js';
|
||||||
|
import moneysData from './moneys.json';
|
||||||
|
import { useQueryParamOrStorage } from '@/composable/queryParams';
|
||||||
|
|
||||||
|
const allCurrencies = Object.entries(moneysData).map(([k, v]) => ({ value: k, label: v || k }));
|
||||||
|
const otherCurrencies = useQueryParamOrStorage<{ name: string }[]>({ name: 'to', storageName: 'currency-conv:others', defaultValue: [{ name: 'usd' }] });
|
||||||
|
const currentCurrency = useQueryParamOrStorage<string>({ name: 'from', storageName: 'currency-conv:cur', defaultValue: 'eur' });
|
||||||
|
const amount = ref(1);
|
||||||
|
const currentDatetime = ref(Date.now());
|
||||||
|
|
||||||
|
const convertedCurrencies = computedAsync<Record<string, number>>(async () => {
|
||||||
|
const currentCurrencyValue = currentCurrency.value;
|
||||||
|
const currentDatetimeValue = currentDatetime.value;
|
||||||
|
const amountValue = amount.value;
|
||||||
|
const otherCurrenciesValues = otherCurrencies.value;
|
||||||
|
|
||||||
|
let result = {};
|
||||||
|
for (const targetCurrency of otherCurrenciesValues) {
|
||||||
|
const value = await converter.convertOnDate(amountValue, currentCurrencyValue, targetCurrency.name, new Date(currentDatetimeValue));
|
||||||
|
result = { ...result, [targetCurrency.name]: value };
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
});
|
||||||
|
|
||||||
|
const countryToCurrenciesInput = ref('France');
|
||||||
|
const allCountries = countries();
|
||||||
|
const countryToCurrenciesOutput = computed(() => country(countryToCurrenciesInput.value));
|
||||||
|
|
||||||
|
const currencyToCountriesInput = ref('eur');
|
||||||
|
const currencyToCountriesOutput = computed(() => code(currencyToCountriesInput.value));
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<div>
|
||||||
|
<c-card title="Currency Converter" mb-2>
|
||||||
|
<c-select
|
||||||
|
v-model:value="currentCurrency"
|
||||||
|
label="From"
|
||||||
|
label-position="left"
|
||||||
|
searchable
|
||||||
|
:options="allCurrencies"
|
||||||
|
mb-2
|
||||||
|
/>
|
||||||
|
<n-form-item label="Amount:" label-placement="left" mb-2>
|
||||||
|
<n-input-number v-model:value="amount" :min="0" />
|
||||||
|
</n-form-item>
|
||||||
|
|
||||||
|
<n-form-item label="For Date:" label-placement="left" mb-2>
|
||||||
|
<n-date-picker
|
||||||
|
v-model:value="currentDatetime"
|
||||||
|
type="date"
|
||||||
|
/>
|
||||||
|
</n-form-item>
|
||||||
|
|
||||||
|
<c-card title="Converted currencies">
|
||||||
|
<n-dynamic-input
|
||||||
|
v-model:value="otherCurrencies"
|
||||||
|
show-sort-button
|
||||||
|
:on-create="() => ({ name: 'eur' })"
|
||||||
|
>
|
||||||
|
<template #default="{ value }">
|
||||||
|
<div flex flex-wrap items-center gap-1>
|
||||||
|
<n-select
|
||||||
|
v-model:value="value.name"
|
||||||
|
filterable
|
||||||
|
placeholder="Please select a currency"
|
||||||
|
:options="allCurrencies"
|
||||||
|
w-full
|
||||||
|
/>
|
||||||
|
<input-copyable readonly :value="convertedCurrencies ? convertedCurrencies[value.name] : 0" />
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
</n-dynamic-input>
|
||||||
|
</c-card>
|
||||||
|
</c-card>
|
||||||
|
|
||||||
|
<c-card title="Country to Currencies" mb-2>
|
||||||
|
<c-select
|
||||||
|
v-model:value="countryToCurrenciesInput"
|
||||||
|
label="Country"
|
||||||
|
label-position="left"
|
||||||
|
searchable
|
||||||
|
:options="allCountries"
|
||||||
|
/>
|
||||||
|
|
||||||
|
<n-divider />
|
||||||
|
|
||||||
|
<ul>
|
||||||
|
<li v-for="(currency, ix) in countryToCurrenciesOutput" :key="ix">
|
||||||
|
{{ currency.currency }} [{{ currency.code }}/{{ currency.number }} - {{ currency.digits }}digits] (also in: {{ currency.countries?.join(', ') }})
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</c-card>
|
||||||
|
|
||||||
|
<c-card title="Currencies to Countries" mb-2>
|
||||||
|
<c-select
|
||||||
|
v-model:value="currencyToCountriesInput"
|
||||||
|
label="Currency"
|
||||||
|
label-position="left"
|
||||||
|
searchable
|
||||||
|
:options="allCurrencies"
|
||||||
|
/>
|
||||||
|
|
||||||
|
<n-divider />
|
||||||
|
|
||||||
|
<n-p v-if="currencyToCountriesOutput">
|
||||||
|
{{ currencyToCountriesOutput.currency }} [{{ currencyToCountriesOutput.code }}/{{ currencyToCountriesOutput.number }} - {{ currencyToCountriesOutput.digits }}digits]
|
||||||
|
</n-p>
|
||||||
|
|
||||||
|
<ul v-if="currencyToCountriesOutput">
|
||||||
|
<li v-for="(countryName, ix) in currencyToCountriesOutput.countries" :key="ix">
|
||||||
|
{{ countryName }}
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</c-card>
|
||||||
|
</div>
|
||||||
|
</template>
|
4
src/tools/currency-converter/currency-exchanger-js.d.ts
vendored
Normal file
4
src/tools/currency-converter/currency-exchanger-js.d.ts
vendored
Normal file
|
@ -0,0 +1,4 @@
|
||||||
|
declare module 'currency-exchanger-js'{
|
||||||
|
export function convertOnDate(value: number,fromCurrency: string,toCurrency: string,inputDate: Date): number;
|
||||||
|
export function convert(value: number,fromCurrency: string,toCurrency: string): number;
|
||||||
|
}
|
12
src/tools/currency-converter/index.ts
Normal file
12
src/tools/currency-converter/index.ts
Normal file
|
@ -0,0 +1,12 @@
|
||||||
|
import { Currency } from '@vicons/tabler';
|
||||||
|
import { defineTool } from '../tool';
|
||||||
|
|
||||||
|
export const tool = defineTool({
|
||||||
|
name: 'Currency Converter',
|
||||||
|
path: '/currency-converter',
|
||||||
|
description: 'Convert currency values using https://github.com/fawazahmed0/exchange-api',
|
||||||
|
keywords: ['currency', 'converter'],
|
||||||
|
component: () => import('./currency-converter.vue'),
|
||||||
|
icon: Currency,
|
||||||
|
createdAt: new Date('2024-08-15'),
|
||||||
|
});
|
1
src/tools/currency-converter/moneys.json
Normal file
1
src/tools/currency-converter/moneys.json
Normal file
File diff suppressed because one or more lines are too long
|
@ -2,6 +2,7 @@ import { tool as base64FileConverter } from './base64-file-converter';
|
||||||
import { tool as base64StringConverter } from './base64-string-converter';
|
import { tool as base64StringConverter } from './base64-string-converter';
|
||||||
import { tool as basicAuthGenerator } from './basic-auth-generator';
|
import { tool as basicAuthGenerator } from './basic-auth-generator';
|
||||||
import { tool as emailNormalizer } from './email-normalizer';
|
import { tool as emailNormalizer } from './email-normalizer';
|
||||||
|
import { tool as currencyConverter } from './currency-converter';
|
||||||
|
|
||||||
import { tool as asciiTextDrawer } from './ascii-text-drawer';
|
import { tool as asciiTextDrawer } from './ascii-text-drawer';
|
||||||
|
|
||||||
|
@ -115,6 +116,7 @@ export const toolsByCategory: ToolCategory[] = [
|
||||||
tomlToYaml,
|
tomlToYaml,
|
||||||
xmlToJson,
|
xmlToJson,
|
||||||
jsonToXml,
|
jsonToXml,
|
||||||
|
currencyConverter,
|
||||||
markdownToHtml,
|
markdownToHtml,
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
|
|
|
@ -151,7 +151,7 @@ function onSearchInput() {
|
||||||
>
|
>
|
||||||
<div flex-1 truncate>
|
<div flex-1 truncate>
|
||||||
<slot name="displayed-value">
|
<slot name="displayed-value">
|
||||||
<input v-if="searchable && isOpen" ref="searchInputRef" v-model="searchQuery" type="text" placeholder="Search..." class="search-input" w-full lh-normal color-current @input="onSearchInput">
|
<input v-if="searchable && isOpen" ref="searchInputRef" v-model="searchQuery" type="text" placeholder="Search..." class="search-input" w-full color-current lh-normal @input="onSearchInput">
|
||||||
<span v-else-if="selectedOption" lh-normal>
|
<span v-else-if="selectedOption" lh-normal>
|
||||||
{{ selectedOption.label }}
|
{{ selectedOption.label }}
|
||||||
</span>
|
</span>
|
||||||
|
|
|
@ -39,7 +39,7 @@ const headers = computed(() => {
|
||||||
<template>
|
<template>
|
||||||
<div class="relative overflow-x-auto rounded">
|
<div class="relative overflow-x-auto rounded">
|
||||||
<table class="w-full border-collapse text-left text-sm text-gray-500 dark:text-gray-400" role="table" :aria-label="description">
|
<table class="w-full border-collapse text-left text-sm text-gray-500 dark:text-gray-400" role="table" :aria-label="description">
|
||||||
<thead v-if="!hideHeaders" class="bg-#ffffff uppercase text-gray-700 dark:bg-#333333 dark:text-gray-400" border-b="1px solid dark:transparent #efeff5">
|
<thead v-if="!hideHeaders" class="bg-#ffffff text-gray-700 uppercase dark:bg-#333333 dark:text-gray-400" border-b="1px solid dark:transparent #efeff5">
|
||||||
<tr>
|
<tr>
|
||||||
<th v-for="header in headers" :key="header.key" scope="col" class="px-6 py-3 text-xs">
|
<th v-for="header in headers" :key="header.key" scope="col" class="px-6 py-3 text-xs">
|
||||||
{{ header.label }}
|
{{ header.label }}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue