add manual time entry modal

This commit is contained in:
Gregor Vostrak
2024-11-14 12:52:53 +01:00
parent dc26d94857
commit 35ac7ad318
4 changed files with 76 additions and 39 deletions
+6 -6
View File
@@ -1,12 +1,12 @@
{
"name": "solidtime",
"version": "0.0.38",
"version": "0.0.39",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "solidtime",
"version": "0.0.37",
"version": "0.0.39",
"hasInstallScript": true,
"dependencies": {
"@electron-toolkit/preload": "^3.0.0",
@@ -14,7 +14,7 @@
"@sentry/electron": "^5.3.0",
"@sentry/vite-plugin": "^2.22.2",
"@solidtime/api": "^0.0.4",
"@solidtime/ui": "^0.0.9",
"@solidtime/ui": "^0.0.11",
"electron-updater": "^6.1.7"
},
"devDependencies": {
@@ -2955,9 +2955,9 @@
}
},
"node_modules/@solidtime/ui": {
"version": "0.0.9",
"resolved": "https://registry.npmjs.org/@solidtime/ui/-/ui-0.0.9.tgz",
"integrity": "sha512-lgfvZPLI18XEahgDqphDv7HUnnGT/BrrbjH33VlhAsMO8kBDEMcVJDDv/9OZhUeMLmCBckWqhiKXAb9rqB37Ow==",
"version": "0.0.11",
"resolved": "https://registry.npmjs.org/@solidtime/ui/-/ui-0.0.11.tgz",
"integrity": "sha512-81UT2s3Td3kc2O1vsXeARq+/N8xXUsJbFypksumT5fvBVFfwkHYDcfazfNAWE44TMNPM6lOYA9vFLaM0tNEGCg==",
"license": "AGPL-3.0",
"peerDependencies": {
"@floating-ui/vue": "^1.1.4",
+2 -2
View File
@@ -1,6 +1,6 @@
{
"name": "solidtime",
"version": "0.0.38",
"version": "0.0.39",
"description": "Desktop App for solidtime - the modern open-source time tracker",
"main": "./out/main/index.js",
"author": "solidtime.io",
@@ -34,7 +34,7 @@
"@sentry/electron": "^5.3.0",
"@sentry/vite-plugin": "^2.22.2",
"@solidtime/api": "^0.0.4",
"@solidtime/ui": "^0.0.9",
"@solidtime/ui": "^0.0.11",
"electron-updater": "^6.1.7"
},
"devDependencies": {
+2 -1
View File
@@ -6,7 +6,8 @@ export function initializeMainWindow(icon: string) {
width: 800,
minWidth: 400,
trafficLightPosition: { x: 15, y: 15 },
height: 600,
minHeight: 400,
height: 800,
show: false,
backgroundColor: '#0f1011',
titleBarStyle: process.platform === 'darwin' ? 'hidden' : 'default',
@@ -7,6 +7,8 @@ import {
TimeTrackerControls,
TimeTrackerRunningInDifferentOrganizationOverlay,
TimeEntryMassActionRow,
TimeEntryCreateModal,
MoreOptionsDropdown,
} from '@solidtime/ui'
import {
emptyTimeEntry,
@@ -35,7 +37,7 @@ import { getAllTags, useTagCreateMutation } from '../utils/tags.ts'
import { LoadingSpinner } from '@solidtime/ui'
import { useLiveTimer } from '../utils/liveTimer.ts'
import { ClockIcon } from '@heroicons/vue/20/solid'
import { ClockIcon, PlusIcon } from '@heroicons/vue/20/solid'
import { CardTitle } from '@solidtime/ui'
import { useStorage } from '@vueuse/core'
import { currentMembershipId, useMyMemberships } from '../utils/myMemberships.ts'
@@ -139,6 +141,14 @@ function createTimeEntry(timeEntry: Omit<CreateTimeEntryBody, 'member_id'>) {
timeEntryCreate.mutate(updatedTimeEntry)
}
function createManualTimeEntry(timeEntry: Omit<CreateTimeEntryBody, 'member_id'>) {
const updatedTimeEntry = {
...timeEntry,
member_id: currentMembershipId.value,
} as CreateTimeEntryBody
timeEntryCreate.mutate(updatedTimeEntry)
}
async function createTag(newTagName: string): Promise<Tag | undefined> {
const { data, mutateAsync } = tagCreate
await mutateAsync({ name: newTagName })
@@ -296,6 +306,8 @@ const canCreateProjects = computed(() => {
}
return false
})
const showManualTimeEntryModal = ref(false)
</script>
<template>
@@ -303,37 +315,61 @@ const canCreateProjects = computed(() => {
<div
v-if="timeEntries && projects && tasks && tags && clients"
class="flex flex-col h-full">
<div
class="px-4 pb-4 pt-2 border-b border-border-primary bg-primary z-10 w-full top-0 left-0">
<CardTitle title="Time Tracker" :icon="ClockIcon as Component"></CardTitle>
<div class="relative">
<TimeTrackerRunningInDifferentOrganizationOverlay
v-if="
currentTimeEntry.organization_id &&
currentTimeEntry.organization_id !== currentOrganizationId
"
@switch-organization="
switchOrganization
"></TimeTrackerRunningInDifferentOrganizationOverlay>
<TimeTrackerControls
v-model:currentTimeEntry="currentTimeEntry"
v-model:liveTimer="liveTimer"
:tags
<div class="flex">
<div
class="pl-4 pb-4 pt-2 border-b border-border-primary bg-primary z-10 w-full top-0 left-0">
<CardTitle title="Time Tracker" :icon="ClockIcon as Component"></CardTitle>
<div class="relative">
<TimeTrackerRunningInDifferentOrganizationOverlay
v-if="
currentTimeEntry.organization_id &&
currentTimeEntry.organization_id !== currentOrganizationId
"
@switch-organization="
switchOrganization
"></TimeTrackerRunningInDifferentOrganizationOverlay>
<TimeTrackerControls
v-model:currentTimeEntry="currentTimeEntry"
v-model:liveTimer="liveTimer"
:tags
:enableEstimatedTime="false"
:canCreateProject="canCreateProjects"
:createProject
:createClient
:tasks
:clients
:projects
:createTag
:isActive
:currency
@start-live-timer="startLiveTimer"
@stop-live-timer="stopLiveTimer"
@start-timer="startTimer"
@stop-timer="stopTimer"
@update-time-entry="updateCurrentTimeEntry"></TimeTrackerControls>
</div>
</div>
<div class="flex justify-center items-center pt-8 group pr-4">
<MoreOptionsDropdown label="More Time Entry Options">
<button
aria-label="Create Manual time entry"
class="flex items-center space-x-3 rounded w-full px-3 py-2.5 text-start text-sm font-medium leading-5 text-white hover:bg-card-background-active focus:outline-none focus:bg-card-background-active transition duration-150 ease-in-out"
@click="showManualTimeEntryModal = true">
<PlusIcon class="w-5 text-icon-active"></PlusIcon>
<span>Create Manual Time Entry</span>
</button>
</MoreOptionsDropdown>
<TimeEntryCreateModal
v-model:show="showManualTimeEntryModal"
:enableEstimatedTime="false"
:canCreateProject="canCreateProjects"
:createProject
:createClient
:tasks
:clients
:createProject="createProject"
:createClient="createClient"
:createTag="createTag"
:createTimeEntry="createManualTimeEntry"
:projects
:createTag
:isActive
:currency
@start-live-timer="startLiveTimer"
@stop-live-timer="stopLiveTimer"
@start-timer="startTimer"
@stop-timer="stopTimer"
@update-time-entry="updateCurrentTimeEntry"></TimeTrackerControls>
:tasks
:tags
:clients></TimeEntryCreateModal>
</div>
</div>
<div class="overflow-y-scroll w-full flex-1">