-
-
Notifications
You must be signed in to change notification settings - Fork 3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix #1001
- Loading branch information
Showing
3 changed files
with
70 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import { ArrowsShuffle } from '@vicons/tabler'; | ||
import { defineTool } from '../tool'; | ||
|
||
export const tool = defineTool({ | ||
name: 'Morse COde Converter', | ||
path: '/morse-converter', | ||
description: 'Encode/Decode to Morse code', | ||
keywords: ['morse', 'converter'], | ||
component: () => import('./morse-converter.vue'), | ||
icon: ArrowsShuffle, | ||
createdAt: new Date('2024-04-20'), | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
<script setup lang="ts"> | ||
import { decode, encode } from 'morsee'; | ||
import { computedCatch } from '@/composable/computed/catchedComputed'; | ||
const encodeInput = ref(''); | ||
const encodeOutput = computed(() => encode(encodeInput.value)); | ||
const decodeInput = ref(''); | ||
const [decodeOutput, decodeError] = computedCatch(() => decode(decodeInput.value), { | ||
defaultValue: '', | ||
defaultErrorMessage: 'Unable to decode your text', | ||
}); | ||
</script> | ||
|
||
<template> | ||
<c-card title="Encode"> | ||
<div flex gap-3> | ||
<c-input-text | ||
v-model:value="encodeInput" | ||
label="Your text:" | ||
placeholder="The string to encode" | ||
rows="4" | ||
multiline raw-text monospace autosize flex-1 | ||
/> | ||
</div> | ||
<c-input-text | ||
label="Your text encoded to Morse code:" | ||
:value="encodeOutput" | ||
rows="3" | ||
placeholder="Your string encoded" | ||
multiline monospace readonly autosize mt-5 | ||
/> | ||
</c-card> | ||
<c-card title="Decode"> | ||
<div flex gap-3> | ||
<c-input-text | ||
v-model:value="decodeInput" | ||
label="Your Morse encoded text:" | ||
placeholder="The string to decode" | ||
rows="4" | ||
multiline raw-text monospace autosize flex-1 | ||
/> | ||
</div> | ||
<c-alert v-if="decodeError" type="error" mt-12 title="Error while decoding"> | ||
{{ decodeError }} | ||
</c-alert> | ||
<c-input-text | ||
v-else | ||
label="Your decoded text:" | ||
:value="decodeOutput" | ||
placeholder="Your string decoded" | ||
rows="3" | ||
multiline monospace readonly autosize mt-5 | ||
/> | ||
</c-card> | ||
</template> |