mirror of
https://github.com/sharevb/it-tools.git
synced 2026-11-24 06:40:20 +03:00
Compare commits
11
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
886d76feff | ||
|
|
52d8f738ef | ||
|
|
e2a1748fa9 | ||
|
|
f0a092f95a | ||
|
|
3993c8bb91 | ||
|
|
f1f2da79c0 | ||
|
|
fa3a858bcf | ||
|
|
87d4e76e8b | ||
|
|
4b42d55812 | ||
|
|
c9f9bb1273 | ||
|
|
f61db56abb |
No files matched your search
Binary file not shown.
|
Before Width: | Height: | Size: 39 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 39 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 7.8 KiB |
@@ -1,8 +1,4 @@
|
||||
<picture>
|
||||
<source srcset="./.github/logo-dark.png" media="(prefers-color-scheme: light)">
|
||||
<source srcset="./.github/logo-white.png" media="(prefers-color-scheme: dark)">
|
||||
<img src="./.github/logo-dark.png" alt="logo">
|
||||
</picture>
|
||||

|
||||
|
||||
Useful tools for developer and people working in IT. [Have a look !](https://it-tools.tech).
|
||||
|
||||
|
||||
Vendored
+2
-5
@@ -129,10 +129,8 @@ declare module '@vue/runtime-core' {
|
||||
MenuLayout: typeof import('./src/components/MenuLayout.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']
|
||||
NA: typeof import('naive-ui')['NA']
|
||||
NavbarButtons: typeof import('./src/components/NavbarButtons.vue')['default']
|
||||
NButton: typeof import('naive-ui')['NButton']
|
||||
NCode: typeof import('naive-ui')['NCode']
|
||||
NCheckbox: typeof import('naive-ui')['NCheckbox']
|
||||
NCollapseTransition: typeof import('naive-ui')['NCollapseTransition']
|
||||
NConfigProvider: typeof import('naive-ui')['NConfigProvider']
|
||||
NDivider: typeof import('naive-ui')['NDivider']
|
||||
@@ -143,8 +141,7 @@ declare module '@vue/runtime-core' {
|
||||
NLayout: typeof import('naive-ui')['NLayout']
|
||||
NLayoutSider: typeof import('naive-ui')['NLayoutSider']
|
||||
NMenu: typeof import('naive-ui')['NMenu']
|
||||
NScrollbar: typeof import('naive-ui')['NScrollbar']
|
||||
NSpin: typeof import('naive-ui')['NSpin']
|
||||
NSpace: typeof import('naive-ui')['NSpace']
|
||||
NTable: typeof import('naive-ui')['NTable']
|
||||
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']
|
||||
|
||||
+1
-1
@@ -298,7 +298,7 @@ tools:
|
||||
|
||||
phone-parser-and-formatter:
|
||||
title: Phone parser and formatter
|
||||
description: Parse, validate and format phone numbers. Get information about the phone number, like the country code, type, etc. Forge link to send message in WhatsApp and SMS.
|
||||
description: Parse, validate and format phone numbers. Get information about the phone number, like the country code, type, etc.
|
||||
|
||||
ipv4-subnet-calculator:
|
||||
title: IPv4 subnet calculator
|
||||
|
||||
@@ -18,9 +18,6 @@ export const tool = defineTool({
|
||||
'cell',
|
||||
'international',
|
||||
'national',
|
||||
'whatsapp',
|
||||
'sms',
|
||||
'message',
|
||||
],
|
||||
component: () => import('./phone-parser-and-formatter.vue'),
|
||||
icon: Phone,
|
||||
|
||||
@@ -9,10 +9,9 @@ import {
|
||||
import { withDefaultOnError } from '@/utils/defaults';
|
||||
import { booleanToHumanReadable } from '@/utils/boolean';
|
||||
import { useValidation } from '@/composable/validation';
|
||||
import { useQueryParamOrStorage } from '@/composable/queryParams';
|
||||
|
||||
const rawPhone = ref('');
|
||||
const defaultCountryCode = useQueryParamOrStorage({ name: 'country', storageName: 'phone-parser:country', defaultValue: getDefaultCountryCode() });
|
||||
const defaultCountryCode = ref(getDefaultCountryCode());
|
||||
const validation = useValidation({
|
||||
source: rawPhone,
|
||||
rules: [
|
||||
@@ -23,16 +22,13 @@ const validation = useValidation({
|
||||
],
|
||||
});
|
||||
|
||||
const parsedRaw = computed(() => {
|
||||
const parsedDetails = computed(() => {
|
||||
if (!validation.isValid) {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
return withDefaultOnError(() => parsePhoneNumber(rawPhone.value, defaultCountryCode.value), undefined);
|
||||
});
|
||||
const parsed = withDefaultOnError(() => parsePhoneNumber(rawPhone.value, defaultCountryCode.value), undefined);
|
||||
|
||||
const parsedDetails = computed(() => {
|
||||
const parsed = parsedRaw.value;
|
||||
if (!parsed) {
|
||||
return undefined;
|
||||
}
|
||||
@@ -85,27 +81,6 @@ const countriesOptions = getCountries().map(code => ({
|
||||
label: `${lookup.byIso(code)?.country || code} (+${getCountryCallingCode(code)})`,
|
||||
value: code,
|
||||
}));
|
||||
|
||||
const messageToSend = ref('');
|
||||
const whatsAppLink = computed(() => {
|
||||
const parsed = parsedRaw.value;
|
||||
if (!parsed) {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
const internationalNoPunts = parsed.formatInternational().replace(/^\+0*/g, '').replace(/\D/g, '');
|
||||
|
||||
return `https://wa.me/${internationalNoPunts}?text=${encodeURIComponent(messageToSend.value)}`;
|
||||
});
|
||||
const smsLink = computed(() => {
|
||||
const parsed = parsedRaw.value;
|
||||
if (!parsed) {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
const internationalNoSpaces = parsed.formatInternational().replace(/\s/g, '');
|
||||
return `sms:${internationalNoSpaces}&body=${encodeURIComponent(messageToSend.value)}`;
|
||||
});
|
||||
</script>
|
||||
|
||||
<template>
|
||||
@@ -135,34 +110,5 @@ const smsLink = computed(() => {
|
||||
</tr>
|
||||
</tbody>
|
||||
</n-table>
|
||||
|
||||
<n-divider />
|
||||
|
||||
<c-input-text
|
||||
v-model:value="messageToSend"
|
||||
multiline
|
||||
rows="4"
|
||||
placeholder="Enter a message to send"
|
||||
label="Message to send:"
|
||||
mb-2
|
||||
/>
|
||||
|
||||
<c-card v-if="whatsAppLink" title="WhatsApp Send link" mb-2>
|
||||
<input-copyable :value="whatsAppLink" mb-2 />
|
||||
<div flex justify-center>
|
||||
<!-- //NOSONAR --><c-button :href="whatsAppLink" target="_blank">
|
||||
Send via WhatsApp
|
||||
</c-button>
|
||||
</div>
|
||||
</c-card>
|
||||
|
||||
<c-card v-if="smsLink" title="SMS Send link">
|
||||
<input-copyable :value="smsLink" mb-2 />
|
||||
<div flex justify-center>
|
||||
<!-- //NOSONAR --><c-button :href="smsLink" target="_blank">
|
||||
Send via SMS
|
||||
</c-button>
|
||||
</div>
|
||||
</c-card>
|
||||
</div>
|
||||
</template>
|
||||
Reference in new issue
Block a user