Skip to content

Commit 35ac7ad

Browse files
committed
add manual time entry modal
1 parent dc26d94 commit 35ac7ad

File tree

4 files changed

+76
-39
lines changed

4 files changed

+76
-39
lines changed

Diff for: package-lock.json

+6-6
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Diff for: package.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "solidtime",
3-
"version": "0.0.38",
3+
"version": "0.0.39",
44
"description": "Desktop App for solidtime - the modern open-source time tracker",
55
"main": "./out/main/index.js",
66
"author": "solidtime.io",
@@ -34,7 +34,7 @@
3434
"@sentry/electron": "^5.3.0",
3535
"@sentry/vite-plugin": "^2.22.2",
3636
"@solidtime/api": "^0.0.4",
37-
"@solidtime/ui": "^0.0.9",
37+
"@solidtime/ui": "^0.0.11",
3838
"electron-updater": "^6.1.7"
3939
},
4040
"devDependencies": {

Diff for: src/main/mainWindow.ts

+2-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@ export function initializeMainWindow(icon: string) {
66
width: 800,
77
minWidth: 400,
88
trafficLightPosition: { x: 15, y: 15 },
9-
height: 600,
9+
minHeight: 400,
10+
height: 800,
1011
show: false,
1112
backgroundColor: '#0f1011',
1213
titleBarStyle: process.platform === 'darwin' ? 'hidden' : 'default',

Diff for: src/renderer/src/components/MainTimeEntryTable.vue

+66-30
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ import {
77
TimeTrackerControls,
88
TimeTrackerRunningInDifferentOrganizationOverlay,
99
TimeEntryMassActionRow,
10+
TimeEntryCreateModal,
11+
MoreOptionsDropdown,
1012
} from '@solidtime/ui'
1113
import {
1214
emptyTimeEntry,
@@ -35,7 +37,7 @@ import { getAllTags, useTagCreateMutation } from '../utils/tags.ts'
3537
import { LoadingSpinner } from '@solidtime/ui'
3638
3739
import { useLiveTimer } from '../utils/liveTimer.ts'
38-
import { ClockIcon } from '@heroicons/vue/20/solid'
40+
import { ClockIcon, PlusIcon } from '@heroicons/vue/20/solid'
3941
import { CardTitle } from '@solidtime/ui'
4042
import { useStorage } from '@vueuse/core'
4143
import { currentMembershipId, useMyMemberships } from '../utils/myMemberships.ts'
@@ -139,6 +141,14 @@ function createTimeEntry(timeEntry: Omit<CreateTimeEntryBody, 'member_id'>) {
139141
timeEntryCreate.mutate(updatedTimeEntry)
140142
}
141143
144+
function createManualTimeEntry(timeEntry: Omit<CreateTimeEntryBody, 'member_id'>) {
145+
const updatedTimeEntry = {
146+
...timeEntry,
147+
member_id: currentMembershipId.value,
148+
} as CreateTimeEntryBody
149+
timeEntryCreate.mutate(updatedTimeEntry)
150+
}
151+
142152
async function createTag(newTagName: string): Promise<Tag | undefined> {
143153
const { data, mutateAsync } = tagCreate
144154
await mutateAsync({ name: newTagName })
@@ -296,44 +306,70 @@ const canCreateProjects = computed(() => {
296306
}
297307
return false
298308
})
309+
310+
const showManualTimeEntryModal = ref(false)
299311
</script>
300312

301313
<template>
302314
<div class="h-[calc(100vh-40px)]">
303315
<div
304316
v-if="timeEntries && projects && tasks && tags && clients"
305317
class="flex flex-col h-full">
306-
<div
307-
class="px-4 pb-4 pt-2 border-b border-border-primary bg-primary z-10 w-full top-0 left-0">
308-
<CardTitle title="Time Tracker" :icon="ClockIcon as Component"></CardTitle>
309-
<div class="relative">
310-
<TimeTrackerRunningInDifferentOrganizationOverlay
311-
v-if="
312-
currentTimeEntry.organization_id &&
313-
currentTimeEntry.organization_id !== currentOrganizationId
314-
"
315-
@switch-organization="
316-
switchOrganization
317-
"></TimeTrackerRunningInDifferentOrganizationOverlay>
318-
<TimeTrackerControls
319-
v-model:currentTimeEntry="currentTimeEntry"
320-
v-model:liveTimer="liveTimer"
321-
:tags
318+
<div class="flex">
319+
<div
320+
class="pl-4 pb-4 pt-2 border-b border-border-primary bg-primary z-10 w-full top-0 left-0">
321+
<CardTitle title="Time Tracker" :icon="ClockIcon as Component"></CardTitle>
322+
<div class="relative">
323+
<TimeTrackerRunningInDifferentOrganizationOverlay
324+
v-if="
325+
currentTimeEntry.organization_id &&
326+
currentTimeEntry.organization_id !== currentOrganizationId
327+
"
328+
@switch-organization="
329+
switchOrganization
330+
"></TimeTrackerRunningInDifferentOrganizationOverlay>
331+
<TimeTrackerControls
332+
v-model:currentTimeEntry="currentTimeEntry"
333+
v-model:liveTimer="liveTimer"
334+
:tags
335+
:enableEstimatedTime="false"
336+
:canCreateProject="canCreateProjects"
337+
:createProject
338+
:createClient
339+
:tasks
340+
:clients
341+
:projects
342+
:createTag
343+
:isActive
344+
:currency
345+
@start-live-timer="startLiveTimer"
346+
@stop-live-timer="stopLiveTimer"
347+
@start-timer="startTimer"
348+
@stop-timer="stopTimer"
349+
@update-time-entry="updateCurrentTimeEntry"></TimeTrackerControls>
350+
</div>
351+
</div>
352+
<div class="flex justify-center items-center pt-8 group pr-4">
353+
<MoreOptionsDropdown label="More Time Entry Options">
354+
<button
355+
aria-label="Create Manual time entry"
356+
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"
357+
@click="showManualTimeEntryModal = true">
358+
<PlusIcon class="w-5 text-icon-active"></PlusIcon>
359+
<span>Create Manual Time Entry</span>
360+
</button>
361+
</MoreOptionsDropdown>
362+
<TimeEntryCreateModal
363+
v-model:show="showManualTimeEntryModal"
322364
:enableEstimatedTime="false"
323-
:canCreateProject="canCreateProjects"
324-
:createProject
325-
:createClient
326-
:tasks
327-
:clients
365+
:createProject="createProject"
366+
:createClient="createClient"
367+
:createTag="createTag"
368+
:createTimeEntry="createManualTimeEntry"
328369
:projects
329-
:createTag
330-
:isActive
331-
:currency
332-
@start-live-timer="startLiveTimer"
333-
@stop-live-timer="stopLiveTimer"
334-
@start-timer="startTimer"
335-
@stop-timer="stopTimer"
336-
@update-time-entry="updateCurrentTimeEntry"></TimeTrackerControls>
370+
:tasks
371+
:tags
372+
:clients></TimeEntryCreateModal>
337373
</div>
338374
</div>
339375
<div class="overflow-y-scroll w-full flex-1">

0 commit comments

Comments
 (0)