+
Skip to content

refactor(ui): replaced some n-input to c-input #505

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 25, 2023
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
2 changes: 2 additions & 0 deletions components.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,11 +68,13 @@ declare module '@vue/runtime-core' {
IconMdiDownload: typeof import('~icons/mdi/download')['default']
IconMdiEye: typeof import('~icons/mdi/eye')['default']
IconMdiEyeOff: typeof import('~icons/mdi/eye-off')['default']
IconMdiMagnify: typeof import('~icons/mdi/magnify')['default']
IconMdiPause: typeof import('~icons/mdi/pause')['default']
IconMdiPlay: typeof import('~icons/mdi/play')['default']
IconMdiRecord: typeof import('~icons/mdi/record')['default']
IconMdiRefresh: typeof import('~icons/mdi/refresh')['default']
IconMdiSearch: typeof import('~icons/mdi/search')['default']
IconMdiSearchRound: typeof import('~icons/mdi/search-round')['default']
IconMdiVideo: typeof import('~icons/mdi/video')['default']
InputCopyable: typeof import('./src/components/InputCopyable.vue')['default']
IntegerBaseConverter: typeof import('./src/tools/integer-base-converter/integer-base-converter.vue')['default']
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ const dockerRun = ref(
);

const conversionResult = computed(() =>
withDefaultOnError(() => composerize(dockerRun.value), { yaml: '', messages: [] }),
withDefaultOnError(() => composerize(dockerRun.value.trim()), { yaml: '', messages: [] }),
);
const dockerCompose = computed(() => conversionResult.value.yaml);
const notImplemented = computed(() =>
Expand All @@ -30,15 +30,16 @@ const { download } = useDownloadFileFromBase64({ source: dockerComposeBase64, fi

<template>
<div>
<n-form-item label="Your docker run command:" :show-feedback="false">
<n-input
v-model:value="dockerRun"
style="font-family: monospace"
type="textarea"
placeholder="Your docker run command to convert..."
rows="3"
/>
</n-form-item>
<c-input-text
v-model:value="dockerRun"
label="Your docker run command:"
style="font-family: monospace"
multiline
raw-text
monospace
placeholder="Your docker run command to convert..."
rows="3"
/>

<n-divider />

Expand Down
78 changes: 28 additions & 50 deletions src/tools/encryption/encryption.vue
Original file line number Diff line number Diff line change
Expand Up @@ -19,18 +19,13 @@ const decryptOutput = computed(() =>
<template>
<c-card title="Encrypt">
<div flex gap-3>
<n-form-item label="Your text:" :show-feedback="false" flex-1>
<n-input
v-model:value="cypherInput"
type="textarea"
placeholder="The string to cypher"
:autosize="{ minRows: 4 }"
autocomplete="off"
autocorrect="off"
autocapitalize="off"
spellcheck="false"
/>
</n-form-item>
<c-input-text
v-model:value="cypherInput"
label="Your text:"
placeholder="The string to cypher"
rows="4"
multiline raw-text monospace autosize flex-1
/>
<div flex flex-1 flex-col gap-2>
<c-input-text v-model:value="cypherSecret" label="Your secret key:" clearable raw-text />

Expand All @@ -42,34 +37,23 @@ const decryptOutput = computed(() =>
</n-form-item>
</div>
</div>
<n-form-item label="Your text encrypted:" :show-feedback="false" mt-5>
<n-input
:value="cypherOutput"
type="textarea"
placeholder="Your string hash"
:autosize="{ minRows: 2 }"
readonly
autocomplete="off"
autocorrect="off"
autocapitalize="off"
spellcheck="false"
/>
</n-form-item>
<c-input-text
label="Your text encrypted:"
:value="cypherOutput"
rows="3"
placeholder="Your string hash"
multiline monospace readonly autosize mt-5
/>
</c-card>
<c-card title="Decrypt">
<div flex gap-3>
<n-form-item label="Your encrypted text:" :show-feedback="false" flex-1>
<n-input
v-model:value="decryptInput"
type="textarea"
placeholder="The string to cypher"
:autosize="{ minRows: 4 }"
autocomplete="off"
autocorrect="off"
autocapitalize="off"
spellcheck="false"
/>
</n-form-item>
<c-input-text
v-model:value="decryptInput"
label="Your encrypted text:"
placeholder="The string to cypher"
rows="4"
multiline raw-text monospace autosize flex-1
/>
<div flex flex-1 flex-col gap-2>
<c-input-text v-model:value="decryptSecret" label="Your secret key:" clearable raw-text />

Expand All @@ -81,18 +65,12 @@ const decryptOutput = computed(() =>
</n-form-item>
</div>
</div>
<n-form-item label="Your decrypted text:" :show-feedback="false" mt-5>
<n-input
:value="decryptOutput"
type="textarea"
placeholder="Your string hash"
:autosize="{ minRows: 2 }"
readonly
autocomplete="off"
autocorrect="off"
autocapitalize="off"
spellcheck="false"
/>
</n-form-item>
<c-input-text
label="Your decrypted text:"
:value="decryptOutput"
placeholder="Your string hash"
rows="3"
multiline monospace readonly autosize mt-5
/>
</c-card>
</template>
2 changes: 1 addition & 1 deletion src/tools/hash-text/hash-text.vue
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ const hashText = (algo: AlgoNames, value: string) => formatWithEncoding(algos[al
<template>
<div>
<c-card>
<n-input v-model:value="clearText" type="textarea" placeholder="Your string to hash..." rows="3" />
<c-input-text v-model:value="clearText" multiline raw-text placeholder="Your string to hash..." rows="3" autosize autofocus label="Your text to hash:" />

<n-divider />

Expand Down
15 changes: 5 additions & 10 deletions src/tools/hmac-generator/hmac-generator.vue
Original file line number Diff line number Diff line change
Expand Up @@ -46,13 +46,10 @@ const { copy } = useCopy({ source: hmac });
</script>

<template>
<div>
<n-form-item label="Plain text to compute the hash">
<n-input v-model:value="plainText" type="textarea" placeholder="Enter the text to compute the hash..." />
</n-form-item>
<n-form-item label="Secret key">
<n-input v-model:value="secret" placeholder="Enter the secret key..." />
</n-form-item>
<div flex flex-col gap-4>
<c-input-text v-model:value="plainText" multiline raw-text placeholder="Plain text to compute the hash..." rows="3" autosize autofocus label="Plain text to compute the hash" />
<c-input-text v-model:value="secret" raw-text placeholder="Enter the secret key..." label="Secret key" clearable />

<div flex gap-2>
<n-form-item label="Hashing function" flex-1>
<n-select
Expand Down Expand Up @@ -86,9 +83,7 @@ const { copy } = useCopy({ source: hmac });
/>
</n-form-item>
</div>
<n-form-item label="HMAC of your text">
<n-input readonly :value="hmac" type="textarea" placeholder="The result of the HMAC..." />
</n-form-item>
<input-copyable v-model:value="hmac" type="textarea" placeholder="The result of the HMAC..." label="HMAC of your text" />
<div flex justify-center>
<c-button @click="copy()">
Copy HMAC
Expand Down
32 changes: 19 additions & 13 deletions src/tools/html-entities/html-entities.vue
Original file line number Diff line number Diff line change
Expand Up @@ -7,29 +7,32 @@ const escapeInput = ref('<title>IT Tool</title>');
const escapeOutput = computed(() => escape(escapeInput.value));
const { copy: copyEscaped } = useCopy({ source: escapeOutput });

const unescapeInput = ref('&lt;title&gt;IT Tool&lt;/title');
const unescapeInput = ref('&lt;title&gt;IT Tool&lt;/title&gt;');
const unescapeOutput = computed(() => unescape(unescapeInput.value));
const { copy: copyUnescaped } = useCopy({ source: unescapeOutput });
</script>

<template>
<c-card title="Escape html entities">
<n-form-item label="Your string :">
<n-input
<c-input-text
v-model:value="escapeInput"
type="textarea"
multiline
placeholder="The string to escape"
:autosize="{ minRows: 2 }"
rows="3"
autosize
raw-text
/>
</n-form-item>

<n-form-item label="Your string escaped :">
<n-input
type="textarea"
<c-input-text
multiline
readonly
placeholder="Your string escaped"
:value="escapeOutput"
:autosize="{ minRows: 2 }"
rows="3"
autosize
/>
</n-form-item>

Expand All @@ -41,21 +44,24 @@ const { copy: copyUnescaped } = useCopy({ source: unescapeOutput });
</c-card>
<c-card title="Unescape html entities">
<n-form-item label="Your escaped string :">
<n-input
<c-input-text
v-model:value="unescapeInput"
type="textarea"
multiline
placeholder="The string to unescape"
:autosize="{ minRows: 2 }"
rows="3"
autosize
raw-text
/>
</n-form-item>

<n-form-item label="Your string unescaped :">
<n-input
<c-input-text
:value="unescapeOutput"
type="textarea"
multiline
readonly
placeholder="Your string unescaped"
:autosize="{ minRows: 2 }"
rows="3"
autosize
/>
</n-form-item>

Expand Down
34 changes: 12 additions & 22 deletions src/tools/http-status-codes/http-status-codes.vue
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
<script setup lang="ts">
import { SearchRound } from '@vicons/material';
import { codesByCategories } from './http-status-codes.constants';
import { useFuzzySearch } from '@/composable/fuzzySearch';

Expand All @@ -24,33 +23,24 @@ const codesByCategoryFiltered = computed(() => {

<template>
<div>
<n-form-item :show-label="false">
<n-input
v-model:value="search"
placeholder="Search http status..."
size="large"
autofocus
mb-10
autocomplete="off"
autocorrect="off"
autocapitalize="off"
>
<template #prefix>
<n-icon :component="SearchRound" />
</template>
</n-input>
</n-form-item>
<c-input-text
v-model:value="search"
placeholder="Search http status..."
autofocus raw-text mb-10
/>

<div v-for="{ codes, category } of codesByCategoryFiltered" :key="category" mb-8>
<n-h2> {{ category }} </n-h2>
<div mb-2 text-xl>
{{ category }}
</div>

<c-card v-for="{ code, description, name, type } of codes" :key="code" mb-2>
<n-text strong block text-lg>
<div text-lg font-bold>
{{ code }} {{ name }}
</n-text>
<n-text block depth="3">
</div>
<div op-70>
{{ description }} {{ type !== 'HTTP' ? `For ${type}.` : '' }}
</n-text>
</div>
</c-card>
</div>
</div>
Expand Down
31 changes: 4 additions & 27 deletions src/tools/integer-base-converter/integer-base-converter.vue
Original file line number Diff line number Diff line change
@@ -1,11 +1,8 @@
<script setup lang="ts">
import InputCopyable from '../../components/InputCopyable.vue';
import { convertBase } from './integer-base-converter.model';
import { useStyleStore } from '@/stores/style.store';
import { getErrorMessageIfThrows } from '@/utils/error';

const styleStore = useStyleStore();

const inputProps = {
'labelPosition': 'left',
'labelWidth': '170px',
Expand Down Expand Up @@ -37,31 +34,11 @@ const error = computed(() =>
<template>
<div>
<c-card>
<div v-if="styleStore.isSmallScreen">
<n-input-group>
<n-input-group-label style="flex: 0 0 120px">
Input number:
</n-input-group-label>
<n-input v-model:value="input" w-full :status="error ? 'error' : undefined" />
</n-input-group>
<n-input-group>
<n-input-group-label style="flex: 0 0 120px">
Input base:
</n-input-group-label>
<n-input-number v-model:value="inputBase" max="64" min="2" w-full />
</n-input-group>
</div>
<c-input-text v-model:value="input" label="Input number" placeholder="Put your number here (ex: 42)" label-position="left" label-width="110px" mb-2 label-align="right" />

<n-input-group v-else>
<n-input-group-label style="flex: 0 0 120px">
Input number:
</n-input-group-label>
<n-input v-model:value="input" :status="error ? 'error' : undefined" />
<n-input-group-label style="flex: 0 0 120px">
Input base:
</n-input-group-label>
<n-input-number v-model:value="inputBase" max="64" min="2" />
</n-input-group>
<n-form-item label="Input base" label-placement="left" label-width="110" :show-feedback="false">
<n-input-number v-model:value="inputBase" max="64" min="2" placeholder="Put your input base here (ex: 10)" w-full />
</n-form-item>

<n-alert v-if="error" style="margin-top: 25px" type="error">
{{ error }}
Expand Down
4 changes: 1 addition & 3 deletions src/tools/jwt-parser/jwt-parser.vue
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,7 @@ const validation = useValidation({

<template>
<c-card>
<n-form-item label="JWT to decode" :feedback="validation.message" :validation-status="validation.status">
<n-input v-model:value="rawJwt" type="textarea" placeholder="Put your token here..." rows="5" />
</n-form-item>
<c-input-text v-model:value="rawJwt" label="JWT to decode" :validation="validation" placeholder="Put your token here..." rows="5" multiline raw-text autofocus mb-3 />

<n-table v-if="validation.isValid">
<tbody>
Expand Down
2 changes: 1 addition & 1 deletion src/tools/lorem-ipsum-generator/lorem-ipsum-generator.vue
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ const { copy } = useCopy({ source: loremIpsumText, text: 'Lorem ipsum copied to
<n-switch v-model:value="asHTML" />
</n-form-item>

<n-input :value="loremIpsumText" type="textarea" placeholder="Your lorem ipsum..." readonly autosize mt-5 />
<c-input-text :value="loremIpsumText" multiline placeholder="Your lorem ipsum..." readonly mt-5 rows="5" />

<div mt-5 flex justify-center>
<c-button autofocus @click="copy">
Expand Down
10 changes: 3 additions & 7 deletions src/tools/math-evaluator/math-evaluator.vue
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,12 @@ const result = computed(() => withDefaultOnError(() => evaluate(expression.value

<template>
<div>
<n-input
<c-input-text
v-model:value="expression"
rows="1"
type="textarea"
multiline
placeholder="Your math expression (ex: 2*sqrt(6) )..."
size="large"
autocomplete="off"
autocorrect="off"
autocapitalize="off"
spellcheck="false"
raw-text
/>

<c-card v-if="result !== ''" title="Result " mt-5>
Expand Down
Loading
点击 这是indexloc提供的php浏览器服务,不要输入任何密码和下载