Skip to content

Commit

Permalink
Use more and new micro icons, update dependencies
Browse files Browse the repository at this point in the history
  • Loading branch information
alinnert committed Dec 19, 2023
1 parent 1fd37ea commit b979cdd
Show file tree
Hide file tree
Showing 19 changed files with 482 additions and 362 deletions.
1 change: 1 addition & 0 deletions .npmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
save-exact=true
481 changes: 249 additions & 232 deletions package-lock.json

Large diffs are not rendered by default.

44 changes: 22 additions & 22 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,29 +13,29 @@
"format": "prettier --write src/"
},
"dependencies": {
"@headlessui/vue": "^1.7.16",
"@heroicons/vue": "^2.0.18",
"date-fns": "^2.30.0",
"pinia": "^2.1.7",
"vue": "^3.3.10"
"@headlessui/vue": "1.7.16",
"@heroicons/vue": "2.1.1",
"date-fns": "2.30.0",
"pinia": "2.1.7",
"vue": "3.3.13"
},
"devDependencies": {
"@rushstack/eslint-patch": "^1.3.3",
"@tsconfig/node18": "^18.2.2",
"@types/node": "^20.10.4",
"@vitejs/plugin-vue": "^4.5.1",
"@vue/eslint-config-prettier": "^8.0.0",
"@vue/eslint-config-typescript": "^12.0.0",
"@vue/tsconfig": "^0.5.0",
"autoprefixer": "^10.4.16",
"eslint": "^8.49.0",
"eslint-plugin-vue": "^9.17.0",
"npm-run-all2": "^6.1.1",
"postcss": "^8.4.32",
"prettier": "^3.0.3",
"tailwindcss": "^3.3.6",
"typescript": "^5.3.3",
"vite": "^5.0.5",
"vue-tsc": "^1.8.25"
"@rushstack/eslint-patch": "1.6.1",
"@tsconfig/node18": "18.2.2",
"@types/node": "20.10.5",
"@vitejs/plugin-vue": "4.5.2",
"@vue/eslint-config-prettier": "8.0.0",
"@vue/eslint-config-typescript": "12.0.0",
"@vue/tsconfig": "0.5.1",
"autoprefixer": "10.4.16",
"eslint": "8.56.0",
"eslint-plugin-vue": "9.19.2",
"npm-run-all2": "6.1.1",
"postcss": "8.4.32",
"prettier": "3.1.1",
"tailwindcss": "3.4.0",
"typescript": "5.3.3",
"vite": "5.0.10",
"vue-tsc": "1.8.25"
}
}
28 changes: 16 additions & 12 deletions src/App.vue
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
<script setup lang="ts">
import { ClipboardDocumentIcon, DocumentDuplicateIcon } from '@heroicons/vue/20/solid'
import {
ArrowRightEndOnRectangleIcon,
ArrowRightStartOnRectangleIcon,
} from '@heroicons/vue/16/solid'
import AddTimestampForm from './components/AddTimestampForm.vue'
import DaySummary from './components/DaySummary.vue'
import DaysList from './components/DaysList.vue'
Expand All @@ -8,34 +11,35 @@ import ImportToolbarForm from './components/ImportToolbarForm.vue'
import TimestampList from './components/TimestampList.vue'
import ToolbarMenu from './components/ToolbarMenu.vue'
import ToolbarMenuItem from './components/ToolbarMenuItem.vue'
import ToolbarTitle from './components/ToolbarTitle.vue'
import UiStack from './components/UiStack.vue'
import UiToolbar from './components/UiToolbar.vue'
import { useTimesStore } from './stores/times'
import ToolbarTitle from './components/ToolbarTitle.vue'
const timesStore = useTimesStore()
</script>

<template>
<div class="fixed inset-0 app-grid app-mobile-grid sm:app-desktop-grid">
<UiToolbar class="[grid-area:header]">
<ToolbarTitle>
<span class="text-[30px]">⏱️</span>
<span>Timetracker</span>
</ToolbarTitle>
<ToolbarTitle>Timetracker</ToolbarTitle>

<ToolbarMenu>
<template #button>Daten</template>

<ToolbarMenuItem @click="timesStore.copyTimesToClipboard">
<DocumentDuplicateIcon class="w-6 h-6 text-sky-700"></DocumentDuplicateIcon>
<span>In Zwischenablage exportieren</span>
</ToolbarMenuItem>

<ToolbarMenuItem @click="timesStore.importTimesFromClipboard">
<ClipboardDocumentIcon class="w-6 h-6 text-amber-700"></ClipboardDocumentIcon>
<ArrowRightEndOnRectangleIcon
class="w-4 h-4 text-gray-600"
></ArrowRightEndOnRectangleIcon>
<span>Aus Zwischenablage importieren</span>
</ToolbarMenuItem>

<ToolbarMenuItem @click="timesStore.copyTimesToClipboard">
<ArrowRightStartOnRectangleIcon
class="w-4 h-4 text-gray-600"
></ArrowRightStartOnRectangleIcon>
<span>In Zwischenablage exportieren</span>
</ToolbarMenuItem>
</ToolbarMenu>

<AddTimestampForm></AddTimestampForm>
Expand Down
2 changes: 1 addition & 1 deletion src/assets/main.css
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,6 @@
grid-template:
'header header' auto
'left main' 1fr
/ 300px 1fr;
/ 360px 1fr;
}
}
127 changes: 127 additions & 0 deletions src/components/DayProgress.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,127 @@
<script setup lang="ts">
import { absDuration } from '@/lib/date-fns/absDuration'
import { formatDuration } from '@/lib/date-fns/formatDuration'
import { getDurationSign } from '@/lib/date-fns/getDurationSign'
import {
ArrowTrendingDownIcon as ArrowTrendingDownIconSmall,
ArrowTrendingUpIcon as ArrowTrendingUpIconSmall,
FlagIcon as FlagIconSmall,
TrophyIcon as TrophyIconSmall,
PauseCircleIcon as PauseCircleIconSmall,
PlayCircleIcon as PlayCircleIconSmall,
} from '@heroicons/vue/16/solid'
import {
ArrowTrendingDownIcon as ArrowTrendingDownIconBig,
ArrowTrendingUpIcon as ArrowTrendingUpIconBig,
FlagIcon as FlagIconBig,
TrophyIcon as TrophyIconBig,
PauseCircleIcon as PauseCircleIconBig,
PlayCircleIcon as PlayCircleIconBig,
} from '@heroicons/vue/24/outline'
import { type Duration, format } from 'date-fns'
import { de } from 'date-fns/locale'
import { computed } from 'vue'
import DayProgressBar from './DayProgressBar.vue'
import UiInlineStack from './UiInlineStack.vue'
const props = defineProps<{
worktime: Duration
breaktime: Duration
remaining?: Duration
targetTime?: Date
isToday?: boolean
workTimeIsLessThan8Hours?: boolean
size: 'small' | 'big'
}>()
const hasOvertime = computed((): boolean => {
if (props.remaining === undefined) {
return false
}
return getDurationSign(props.remaining) === -1
})
</script>

<template>
<div class="grid gap-2">
<DayProgressBar :value="props.worktime"></DayProgressBar>

<div class="flex gap-4" :class="{ 'text-xs': size === 'small', 'text-sm': size === 'big' }">
<UiInlineStack>
<template v-if="size === 'small'">
<PlayCircleIconSmall class="w-4 h-4 text-sky-600"></PlayCircleIconSmall>
</template>
<template v-if="size === 'big'">
<PlayCircleIconBig class="w-6 h-6 text-sky-600"></PlayCircleIconBig>
</template>

<span class="font-mono">{{ formatDuration(worktime) }}</span>
</UiInlineStack>

<template v-if="remaining !== undefined">
<UiInlineStack>
<template v-if="isToday">
<template v-if="hasOvertime">
<TrophyIconSmall
v-if="size === 'small'"
class="w-4 h-4 text-yellow-500"
></TrophyIconSmall>
<TrophyIconBig v-if="size === 'big'" class="w-6 h-6 text-yellow-500"></TrophyIconBig>
</template>
<template v-else>
<FlagIconSmall
v-if="size === 'small'"
class="w-4 h-4 text-emerald-600"
></FlagIconSmall>
<FlagIconBig v-if="size === 'big'" class="w-6 h-6 text-emerald-600"></FlagIconBig>
</template>
</template>
<template v-else>
<template v-if="hasOvertime">
<ArrowTrendingUpIconSmall
v-if="size === 'small'"
class="w-4 h-4 text-sky-600"
></ArrowTrendingUpIconSmall>
<ArrowTrendingUpIconBig
v-if="size === 'big'"
class="w-6 h-6 text-sky-600"
></ArrowTrendingUpIconBig>
</template>
<template v-else>
<ArrowTrendingDownIconSmall
v-if="size === 'small'"
class="w-4 h-4 text-orange-600"
></ArrowTrendingDownIconSmall>
<ArrowTrendingDownIconBig
v-if="size === 'big'"
class="w-6 h-6 text-orange-600"
></ArrowTrendingDownIconBig>
</template>
</template>

<span class="font-mono">{{ formatDuration(absDuration(remaining)) }}</span>

<template v-if="targetTime !== undefined">
<span>um </span>
<span class="font-mono font-bold">{{
format(targetTime, 'HH:mm', { locale: de })
}}</span>
</template>
</UiInlineStack>
</template>

<UiInlineStack class="ml-auto">
<PauseCircleIconSmall
v-if="size === 'small'"
class="w-4 h-4 text-yellow-600"
></PauseCircleIconSmall>
<PauseCircleIconBig
v-if="size === 'big'"
class="w-6 h-6 text-yellow-600"
></PauseCircleIconBig>

<span class="font-mono">{{ formatDuration(breaktime) }}</span>
</UiInlineStack>
</div>
</div>
</template>
File renamed without changes.
75 changes: 14 additions & 61 deletions src/components/DaySummary.vue
Original file line number Diff line number Diff line change
@@ -1,69 +1,22 @@
<script setup lang="ts">
import { useTimesStore } from '@/stores/times'
import { format, formatDuration } from 'date-fns'
import { de } from 'date-fns/locale'
import { computed } from 'vue'
import HoursProgress from './HoursProgress.vue'
import DayProgress from './DayProgress.vue'
const timesStore = useTimesStore()
const lessThan8Hours = computed(() => (timesStore.workTimeOfSelectedDay.hours ?? 0) < 8)
const remainingLabel = computed(() =>
lessThan8Hours.value ? '8 Stunden erreicht in' : 'Überstunden',
)
</script>

<template>
<div>
<div class="text-lg font-bold mb-2">Zusammenfassung</div>
<div class="grid grid-cols-[1fr,auto] gap-2">
<div>
<div class="text-gray-500">Arbeitszeit</div>
<div class="font-bold">
{{
formatDuration(timesStore.workTimeOfSelectedDay, {
format: ['hours', 'minutes'],
locale: de,
}) || '-'
}}
</div>
</div>
<div class="text-right">
<div class="text-gray-500">{{ remainingLabel }}</div>
<div>
<span class="font-bold">
{{
formatDuration(timesStore.remainingWorkTimeOfSelectedDay, {
format: ['hours', 'minutes'],
locale: de,
})
}}
</span>
<template v-if="lessThan8Hours && timesStore.selectedDayIsToday">
<span> um </span>
<span class="font-bold">
{{
format(timesStore.timeAfterRemainingWorkTimeOfSelectedDay, 'HH:mm', { locale: de })
}}
</span>
</template>
</div>
</div>
<div class="col-span-2">
<HoursProgress :value="timesStore.workTimeOfSelectedDay"></HoursProgress>
</div>
<div>
<div class="text-gray-500">Pausenzeit</div>
<div class="font-bold">
{{
formatDuration(timesStore.breakTimeOfSelectedDay, {
format: ['hours', 'minutes'],
locale: de,
}) || '-'
}}
</div>
</div>
</div>
</div>
<DayProgress
:worktime="timesStore.workTimeOfSelectedDay"
:breaktime="timesStore.breakTimeOfSelectedDay"
:remaining="timesStore.remainingWorkTimeOfSelectedDay"
:is-today="timesStore.selectedDayIsToday"
:work-time-is-less-than8-hours="timesStore.workTimeOfSelectedDayIsLessThan8Hours"
:target-time="
timesStore.workTimeOfSelectedDayIsLessThan8Hours && timesStore.selectedDayIsToday
? timesStore.timeAfterRemainingWorkTimeOfSelectedDay
: undefined
"
size="big"
></DayProgress>
</template>
26 changes: 4 additions & 22 deletions src/components/DaysListItem.vue
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@ import { useTimesStore } from '@/stores/times'
import { format, isSameDay } from 'date-fns'
import { de } from 'date-fns/locale'
import { computed } from 'vue'
import { formatDuration } from '../lib/date-fns/formatDuration'
import HoursProgress from './HoursProgress.vue'
import DayProgress from './DayProgress.vue'
import UiStack from './UiStack.vue'
const props = defineProps<{ day: Date }>()
Expand All @@ -14,14 +13,6 @@ const timesStore = useTimesStore()
const dayInfo = computed(() => {
return timesStore.getDayInfo(props.day)
})
const workTime = computed(() => {
return formatDuration(dayInfo.value.worktime)
})
const breakTime = computed(() => {
return formatDuration(dayInfo.value.break)
})
</script>

<template>
Expand All @@ -36,23 +27,14 @@ const breakTime = computed(() => {
<UiStack :gap="2">
<div
class="flex-grow flex justify-between"
:class="{ 'opacity-50 italic': dayInfo.timestampsCount === 0 }"
:class="{ 'opacity-50': dayInfo.timestampsCount === 0 }"
>
<span class="font-mono font-bold">{{ format(day, 'dd.MM.yyyy', { locale: de }) }}</span>
<span class="font-bold">{{ format(day, 'dd.MM.yyyy', { locale: de }) }}</span>
<span>{{ format(day, 'EEEEEEE', { locale: de }) }}</span>
</div>

<template v-if="dayInfo.timestampsCount > 0">
<HoursProgress :value="dayInfo.worktime"></HoursProgress>

<div class="text-xs flex justify-between">
<div>
<span class="font-mono">{{ workTime }}</span>
</div>
<div>
Pause: <span class="font-mono">{{ breakTime }}</span>
</div>
</div>
<DayProgress :worktime="dayInfo.worktime" :breaktime="dayInfo.break" size="small"></DayProgress>
</template>
</UiStack>
</div>
Expand Down
2 changes: 1 addition & 1 deletion src/components/ToolbarButton.vue
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<template>
<button
class="flex items-center gap-2 px-3 py-1 bg-gray-100 hover:bg-gray-200 active:bg-gray-300 rounded border border-gray-300 hover:border-gray-400 active:border-gray-400 cursor-default select-none"
class="flex items-center gap-2 px-3 py-1 text-sm bg-gray-100 hover:bg-gray-200 active:bg-gray-300 rounded border border-gray-300 hover:border-gray-400 active:border-gray-400 cursor-default select-none"
>
<slot></slot>
</button>
Expand Down
Loading

0 comments on commit b979cdd

Please sign in to comment.