feat: improve datemathHelp.vue

This commit is contained in:
Dominik Pschenitschni 2023-03-07 18:01:54 +01:00 committed by konrad
parent 14666cf9d8
commit 795b26e1dd
3 changed files with 26 additions and 12 deletions

View File

@ -0,0 +1,11 @@
<script setup lang="ts">
import datemathHelp from './datemathHelp.vue'
</script>
<template>
<Story>
<Variant title="Default">
<datemathHelp />
</Variant>
</Story>
</template>

View File

@ -1,7 +1,8 @@
<template> <template>
<card <card
class="has-no-shadow how-it-works-modal" class="has-no-shadow how-it-works-modal"
:title="$t('input.datemathHelp.title')"> :title="$t('input.datemathHelp.title')"
>
<p> <p>
{{ $t('input.datemathHelp.intro') }} {{ $t('input.datemathHelp.intro') }}
</p> </p>
@ -27,11 +28,11 @@
</p> </p>
<p>{{ $t('misc.forExample') }}</p> <p>{{ $t('misc.forExample') }}</p>
<ul> <ul>
<li><code>+1d</code>{{ $t('input.datemathHelp.add1Day') }}</li> <li><code>+1d</code> {{ $t('input.datemathHelp.add1Day') }}</li>
<li><code>-1d</code>{{ $t('input.datemathHelp.minus1Day') }}</li> <li><code>-1d</code> {{ $t('input.datemathHelp.minus1Day') }}</li>
<li><code>/d</code>{{ $t('input.datemathHelp.roundDay') }}</li> <li><code>/d</code> {{ $t('input.datemathHelp.roundDay') }}</li>
</ul> </ul>
<p>{{ $t('input.datemathHelp.supportedUnits') }}</p> <h3>{{ $t('input.datemathHelp.supportedUnits') }}</h3>
<table class="table"> <table class="table">
<tbody> <tbody>
<tr> <tr>
@ -69,7 +70,7 @@
</tbody> </tbody>
</table> </table>
<p>{{ $t('input.datemathHelp.someExamples') }}</p> <h3>{{ $t('input.datemathHelp.someExamples') }}</h3>
<table class="table"> <table class="table">
<tbody> <tbody>
<tr> <tr>
@ -100,7 +101,7 @@
<td><code>{{ exampleDate }}||+1M/d</code></td> <td><code>{{ exampleDate }}||+1M/d</code></td>
<td> <td>
<i18n-t keypath="input.datemathHelp.examples.datePlusMonth" scope="global"> <i18n-t keypath="input.datemathHelp.examples.datePlusMonth" scope="global">
<code>{{ exampleDate }}</code> <strong>{{ exampleDate }}</strong>
</i18n-t> </i18n-t>
</td> </td>
</tr> </tr>
@ -110,13 +111,15 @@
</template> </template>
<script lang="ts" setup> <script lang="ts" setup>
import {formatDate} from '@/helpers/time/formatDate' import {formatDateShort} from '@/helpers/time/formatDate'
import BaseButton from '@/components/base/BaseButton.vue' import BaseButton from '@/components/base/BaseButton.vue'
const exampleDate = formatDate(new Date(), 'yyyy-MM-dd') const exampleDate = formatDateShort(new Date())
</script> </script>
<style scoped lang="scss"> <style scoped lang="scss">
// FIXME: Remove style overwrites
.how-it-works-modal { .how-it-works-modal {
font-size: 1rem; font-size: 1rem;
} }

View File

@ -569,14 +569,14 @@
"canuse": "You can use date math to filter for relative dates.", "canuse": "You can use date math to filter for relative dates.",
"learnhow": "Check out how it works", "learnhow": "Check out how it works",
"title": "Date Math", "title": "Date Math",
"intro": "Date Math allows you to specify relative dates which are resolved on the fly by Vikunja when applying the filter.", "intro": "Specify relative dates which are resolved on the fly by Vikunja when applying the filter.",
"expression": "Each Date Math expression starts with an anchor date, which can either be {0}, or a date string ending with {1}. This anchor date can optionally be followed by one or more maths expressions.", "expression": "Each Date Math expression starts with an anchor date, which can either be {0}, or a date string ending with {1}. This anchor date can optionally be followed by one or more maths expressions.",
"similar": "These expressions are similar to the ones provided by {0} and {1}.", "similar": "These expressions are similar to the ones provided by {0} and {1}.",
"add1Day": "Add one day", "add1Day": "Add one day",
"minus1Day": "Subtract one day", "minus1Day": "Subtract one day",
"roundDay": "Round down to the nearest day", "roundDay": "Round down to the nearest day",
"supportedUnits": "Supported time units are:", "supportedUnits": "Supported time units",
"someExamples": "Some examples of time expressions:", "someExamples": "Examples of time expressions",
"units": { "units": {
"seconds": "Seconds", "seconds": "Seconds",
"minutes": "Minutes", "minutes": "Minutes",