mirror of
https://github.com/solidtime-io/solidtime.git
synced 2026-10-18 10:43:18 +01:00
Compare commits
9 Commits
feature/ex
...
6f2e4ff977
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
6f2e4ff977 | ||
|
|
8609635d74 | ||
|
|
5a07f798b3 | ||
|
|
3af69830ee | ||
|
|
a050153bcd | ||
|
|
9d9731c7ce | ||
|
|
dfe3206614 | ||
|
|
97fd882878 | ||
|
|
111e12df12 |
1
.github/VOUCHED.td
vendored
1
.github/VOUCHED.td
vendored
@@ -18,6 +18,7 @@ bufferhead-code
|
|||||||
candideu
|
candideu
|
||||||
kasparrosin
|
kasparrosin
|
||||||
korridor
|
korridor
|
||||||
|
nikbucher tasks table sorting
|
||||||
onatcer
|
onatcer
|
||||||
shrootbuck
|
shrootbuck
|
||||||
smilebeda
|
smilebeda
|
||||||
|
|||||||
@@ -33,8 +33,8 @@ class RouteServiceProvider extends ServiceProvider
|
|||||||
}
|
}
|
||||||
|
|
||||||
return $request->user()
|
return $request->user()
|
||||||
? Limit::perMinute(200)->by($request->user()->id)
|
? Limit::perMinute(config('app.api_rate_limit_authenticated_per_minute'))->by($request->user()->id)
|
||||||
: Limit::perMinute(60)->by($request->ip());
|
: Limit::perMinute(config('app.api_rate_limit_guest_per_minute'))->by($request->ip());
|
||||||
});
|
});
|
||||||
|
|
||||||
$this->routes(function (): void {
|
$this->routes(function (): void {
|
||||||
|
|||||||
@@ -155,9 +155,10 @@ class LocalizationService
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Time group types have no server-side descriptor; Day and Week keys are ISO dates and
|
* Time group types have no server-side descriptor; their keys are ISO dates and are
|
||||||
* formatted here instead. A Week key is the first day of that week, so it renders as the
|
* formatted here instead. A Week key is the first day of that week, so it renders as the
|
||||||
* range it covers.
|
* range it covers. A Year key is already a bare year, so it is returned unchanged - it must
|
||||||
|
* not be parsed, Carbon reads a four digit string as a time of day.
|
||||||
*/
|
*/
|
||||||
public function formatTimeGroupKey(?string $key, TimeEntryAggregationType $groupType): ?string
|
public function formatTimeGroupKey(?string $key, TimeEntryAggregationType $groupType): ?string
|
||||||
{
|
{
|
||||||
@@ -175,6 +176,13 @@ class LocalizationService
|
|||||||
return $this->formatDate($weekStart).' - '.$this->formatDate($weekStart->copy()->addDays(6));
|
return $this->formatDate($weekStart).' - '.$this->formatDate($weekStart->copy()->addDays(6));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ($groupType === TimeEntryAggregationType::Month) {
|
||||||
|
// Note: the leading "!" resets all fields the format does not name. Without it the
|
||||||
|
// day of the month is taken from today, and a day that the parsed month does not
|
||||||
|
// have overflows the date into the next month.
|
||||||
|
return Carbon::createFromFormat('!Y-m', $key)->format('F Y');
|
||||||
|
}
|
||||||
|
|
||||||
return $key;
|
return $key;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -158,6 +158,21 @@ return [
|
|||||||
|
|
||||||
'pagination_per_page_default' => (int) env('PAGINATION_PER_PAGE_DEFAULT', 15),
|
'pagination_per_page_default' => (int) env('PAGINATION_PER_PAGE_DEFAULT', 15),
|
||||||
|
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| API Rate Limiting
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
| The number of API requests allowed per minute, counted per user for
|
||||||
|
| authenticated requests and per IP address for guest requests. These
|
||||||
|
| limits are only enforced when the application runs in production.
|
||||||
|
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
'api_rate_limit_authenticated_per_minute' => (int) (env('API_RATE_LIMIT_AUTH_PER_MINUTE') ?: 200),
|
||||||
|
|
||||||
|
'api_rate_limit_guest_per_minute' => (int) (env('API_RATE_LIMIT_GUEST_PER_MINUTE') ?: 60),
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|--------------------------------------------------------------------------
|
|--------------------------------------------------------------------------
|
||||||
| Encryption Key
|
| Encryption Key
|
||||||
|
|||||||
4375
package-lock.json
generated
4375
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
28
package.json
28
package.json
@@ -26,13 +26,13 @@
|
|||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@eslint/eslintrc": "^3.3.5",
|
"@eslint/eslintrc": "^3.3.5",
|
||||||
"@eslint/js": "^9.39.4",
|
"@eslint/js": "^10.0.1",
|
||||||
"@inertiajs/vue3": "^2.3.23",
|
"@inertiajs/vue3": "^3.6.1",
|
||||||
"@playwright/test": "^1.60.0",
|
"@playwright/test": "^1.60.0",
|
||||||
"@tailwindcss/forms": "^0.5.11",
|
"@tailwindcss/forms": "^0.5.11",
|
||||||
"@tailwindcss/typography": "^0.5.19",
|
"@tailwindcss/typography": "^0.5.19",
|
||||||
"@types/chroma-js": "^3.1.2",
|
"@types/chroma-js": "^3.1.2",
|
||||||
"@types/node": "^22.19.19",
|
"@types/node": "^26.2.0",
|
||||||
"@vitejs/plugin-vue": "^6.0.6",
|
"@vitejs/plugin-vue": "^6.0.6",
|
||||||
"@vue/test-utils": "^2.4.6",
|
"@vue/test-utils": "^2.4.6",
|
||||||
"@vue/tsconfig": "^0.8.1",
|
"@vue/tsconfig": "^0.8.1",
|
||||||
@@ -40,14 +40,14 @@
|
|||||||
"axios": "^1.16.0",
|
"axios": "^1.16.0",
|
||||||
"eslint-plugin-unused-imports": "^4.4.1",
|
"eslint-plugin-unused-imports": "^4.4.1",
|
||||||
"happy-dom": "^20.8.9",
|
"happy-dom": "^20.8.9",
|
||||||
"laravel-vite-plugin": "^2.1.0",
|
"laravel-vite-plugin": "^3.2.0",
|
||||||
"openapi-zod-client": "^1.18.3",
|
"openapi-zod-client": "^1.18.3",
|
||||||
"postcss": "^8.5.14",
|
"postcss": "^8.5.14",
|
||||||
"postcss-import": "^15.1.0",
|
"postcss-import": "^17.0.0",
|
||||||
"postcss-nesting": "^12.1.5",
|
"postcss-nesting": "^14.0.1",
|
||||||
"tailwindcss": "^3.4.19",
|
"tailwindcss": "^4.3.3",
|
||||||
"typescript": "^5.9.3",
|
"typescript": "^7.0.2",
|
||||||
"vite": "^7.3.3",
|
"vite": "^8.2.1",
|
||||||
"vite-plugin-checker": "^0.12.0",
|
"vite-plugin-checker": "^0.12.0",
|
||||||
"vitest": "^4.1.4",
|
"vitest": "^4.1.4",
|
||||||
"vue": "^3.5.34",
|
"vue": "^3.5.34",
|
||||||
@@ -55,15 +55,15 @@
|
|||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@floating-ui/core": "^1.7.5",
|
"@floating-ui/core": "^1.7.5",
|
||||||
"@floating-ui/vue": "^1.1.11",
|
"@floating-ui/vue": "^2.0.1",
|
||||||
"@heroicons/vue": "^2.2.0",
|
"@heroicons/vue": "^2.2.0",
|
||||||
"@lucide/vue": "^1.14.0",
|
"@lucide/vue": "^1.14.0",
|
||||||
"@rushstack/eslint-patch": "^1.16.1",
|
"@rushstack/eslint-patch": "^1.16.1",
|
||||||
"@tailwindcss/container-queries": "^0.1.1",
|
"@tailwindcss/container-queries": "^0.1.1",
|
||||||
"@tanstack/vue-form": "^1.32.0",
|
"@tanstack/vue-form": "^1.32.0",
|
||||||
"@tanstack/vue-query": "^5.100.10",
|
"@tanstack/vue-query": "^5.100.10",
|
||||||
"@tanstack/vue-query-devtools": "^5.91.0",
|
"@tanstack/vue-query-devtools": "^6.1.38",
|
||||||
"@tanstack/vue-table": "^8.21.3",
|
"@tanstack/vue-table": "^9.1.2",
|
||||||
"@tanstack/vue-virtual": "^3.13.24",
|
"@tanstack/vue-virtual": "^3.13.24",
|
||||||
"@vue/eslint-config-prettier": "^10.2.0",
|
"@vue/eslint-config-prettier": "^10.2.0",
|
||||||
"@vue/eslint-config-typescript": "^14.7.0",
|
"@vue/eslint-config-typescript": "^14.7.0",
|
||||||
@@ -77,10 +77,10 @@
|
|||||||
"echarts": "^6.0.0",
|
"echarts": "^6.0.0",
|
||||||
"focus-trap": "^8.2.0",
|
"focus-trap": "^8.2.0",
|
||||||
"parse-duration": "^2.1.6",
|
"parse-duration": "^2.1.6",
|
||||||
"pinia": "^3.0.4",
|
"pinia": "^4.0.3",
|
||||||
"radix-vue": "^1.9.17",
|
"radix-vue": "^1.9.17",
|
||||||
"reka-ui": "^2.9.7",
|
"reka-ui": "^2.9.7",
|
||||||
"tailwind-merge": "^2.6.1",
|
"tailwind-merge": "^3.6.0",
|
||||||
"tailwindcss-animate": "^1.0.7",
|
"tailwindcss-animate": "^1.0.7",
|
||||||
"vue-draggable-plus": "^0.6.1",
|
"vue-draggable-plus": "^0.6.1",
|
||||||
"vue-echarts": "^8.0.1",
|
"vue-echarts": "^8.0.1",
|
||||||
|
|||||||
@@ -29,7 +29,7 @@
|
|||||||
"author": "solidtime",
|
"author": "solidtime",
|
||||||
"license": "AGPL-3.0",
|
"license": "AGPL-3.0",
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"vite-plugin-dts": "^4.5.4"
|
"vite-plugin-dts": "^5.0.3"
|
||||||
},
|
},
|
||||||
"peerDependencies": {
|
"peerDependencies": {
|
||||||
"@zodios/core": "^10.9.6",
|
"@zodios/core": "^10.9.6",
|
||||||
|
|||||||
@@ -50,7 +50,7 @@
|
|||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@types/chroma-js": "^3.1.2",
|
"@types/chroma-js": "^3.1.2",
|
||||||
"@zodios/core": "^10.9.6",
|
"@zodios/core": "^10.9.6",
|
||||||
"vite-plugin-dts": "^4.5.4",
|
"vite-plugin-dts": "^5.0.3",
|
||||||
"zod": "^3.25.76"
|
"zod": "^3.25.76"
|
||||||
},
|
},
|
||||||
"peerDependencies": {
|
"peerDependencies": {
|
||||||
|
|||||||
@@ -31,7 +31,7 @@ const forwarded = useForwardPropsEmits(delegatedProps, emits);
|
|||||||
<div
|
<div
|
||||||
:class="
|
:class="
|
||||||
cn(
|
cn(
|
||||||
'fixed top-0 left-0 z-50 pointer-events-none w-screen h-screen flex items-start px-2 pt-3 md:pt-14 xl:pt-24 justify-center overflow-auto'
|
'fixed top-0 left-0 z-50 pointer-events-none w-screen h-screen [height:100dvh] flex items-start px-2 py-3 md:py-14 xl:py-24 justify-center overflow-y-auto overscroll-contain'
|
||||||
)
|
)
|
||||||
">
|
">
|
||||||
<DialogContent
|
<DialogContent
|
||||||
|
|||||||
@@ -1,5 +1,10 @@
|
|||||||
import { describe, expect, test } from 'vitest';
|
import { describe, expect, test } from 'vitest';
|
||||||
import { formatHumanReadableDuration, formatReportingDuration, formatWeekRange } from './time';
|
import {
|
||||||
|
formatHumanReadableDuration,
|
||||||
|
formatMonth,
|
||||||
|
formatReportingDuration,
|
||||||
|
formatWeekRange,
|
||||||
|
} from './time';
|
||||||
|
|
||||||
const seconds = 14 * 3600 + 45 * 60 + 6; // 14h 45m 06s
|
const seconds = 14 * 3600 + 45 * 60 + 6; // 14h 45m 06s
|
||||||
|
|
||||||
@@ -60,3 +65,9 @@ describe('formatWeekRange', () => {
|
|||||||
);
|
);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
describe('formatMonth', () => {
|
||||||
|
test('renders the name of the month that the key covers', () => {
|
||||||
|
expect(formatMonth('2001-02')).toBe('February 2001');
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|||||||
@@ -245,6 +245,15 @@ export function formatWeekRange(date: string, format?: DateFormat): string {
|
|||||||
return `${formatDate(date, format)} - ${formatDate(end, format)}`;
|
return `${formatDate(date, format)} - ${formatDate(end, format)}`;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Returns the month that the given key falls in. There is no `DateFormat` variant for a
|
||||||
|
* month, so this is not affected by the organization date format.
|
||||||
|
* @param date - a month, in the format of 'YYYY-MM'
|
||||||
|
*/
|
||||||
|
export function formatMonth(date: string): string {
|
||||||
|
return getDayJsInstance()(date).format('MMMM YYYY');
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Returns a human readable date format.
|
* Returns a human readable date format.
|
||||||
* @param date - date in the format of 'YYYY-MM-DD'
|
* @param date - date in the format of 'YYYY-MM-DD'
|
||||||
|
|||||||
@@ -15,7 +15,12 @@ import {
|
|||||||
} from '@heroicons/vue/16/solid';
|
} from '@heroicons/vue/16/solid';
|
||||||
import { Coffee } from '@lucide/vue';
|
import { Coffee } from '@lucide/vue';
|
||||||
import BillableIcon from '@/packages/ui/src/Icons/BillableIcon.vue';
|
import BillableIcon from '@/packages/ui/src/Icons/BillableIcon.vue';
|
||||||
import { type DateFormat, formatDate, formatWeekRange } from '@/packages/ui/src/utils/time';
|
import {
|
||||||
|
type DateFormat,
|
||||||
|
formatDate,
|
||||||
|
formatMonth,
|
||||||
|
formatWeekRange,
|
||||||
|
} from '@/packages/ui/src/utils/time';
|
||||||
|
|
||||||
export type GroupingOption =
|
export type GroupingOption =
|
||||||
| 'project'
|
| 'project'
|
||||||
@@ -27,7 +32,9 @@ export type GroupingOption =
|
|||||||
| 'tag'
|
| 'tag'
|
||||||
| 'type'
|
| 'type'
|
||||||
| 'day'
|
| 'day'
|
||||||
| 'week';
|
| 'week'
|
||||||
|
| 'month'
|
||||||
|
| 'year';
|
||||||
|
|
||||||
export const useReportingStore = defineStore('reporting', () => {
|
export const useReportingStore = defineStore('reporting', () => {
|
||||||
// Cache query composables to avoid creating new subscriptions on every call
|
// Cache query composables to avoid creating new subscriptions on every call
|
||||||
@@ -94,6 +101,10 @@ export const useReportingStore = defineStore('reporting', () => {
|
|||||||
if (type === 'week') {
|
if (type === 'week') {
|
||||||
return formatWeekRange(key, dateFormat);
|
return formatWeekRange(key, dateFormat);
|
||||||
}
|
}
|
||||||
|
if (type === 'month') {
|
||||||
|
return formatMonth(key);
|
||||||
|
}
|
||||||
|
// A `year` key is already a bare year, so it falls through unchanged.
|
||||||
return key;
|
return key;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -364,14 +364,27 @@ class LocalizationServiceTest extends TestCaseWithDatabase
|
|||||||
$this->assertSame('29/12/2025 - 04/01/2026', $formatted);
|
$this->assertSame('29/12/2025 - 04/01/2026', $formatted);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function test_format_time_group_key_does_not_change_month_year_and_entity_group_types(): void
|
public function test_format_time_group_key_formats_a_month_key_and_does_not_change_year_and_entity_group_types(): void
|
||||||
{
|
{
|
||||||
// Arrange
|
// Arrange
|
||||||
$this->localizationService->setDateFormat(DateFormat::SlashSeparatedDDMMYYYY);
|
$this->localizationService->setDateFormat(DateFormat::SlashSeparatedDDMMYYYY);
|
||||||
|
|
||||||
// Act & Assert
|
// Act & Assert
|
||||||
$this->assertSame('2001-02', $this->localizationService->formatTimeGroupKey('2001-02', TimeEntryAggregationType::Month));
|
$this->assertSame('February 2001', $this->localizationService->formatTimeGroupKey('2001-02', TimeEntryAggregationType::Month));
|
||||||
$this->assertSame('2001', $this->localizationService->formatTimeGroupKey('2001', TimeEntryAggregationType::Year));
|
$this->assertSame('2001', $this->localizationService->formatTimeGroupKey('2001', TimeEntryAggregationType::Year));
|
||||||
$this->assertSame('some-uuid', $this->localizationService->formatTimeGroupKey('some-uuid', TimeEntryAggregationType::Project));
|
$this->assertSame('some-uuid', $this->localizationService->formatTimeGroupKey('some-uuid', TimeEntryAggregationType::Project));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function test_format_time_group_key_formats_a_month_key_independently_of_the_current_day_of_month(): void
|
||||||
|
{
|
||||||
|
// Arrange
|
||||||
|
// Note: the current day of the month must not leak into the parsed month. The 31st does
|
||||||
|
// not exist in April, so a leaked day overflows the date into the following month.
|
||||||
|
$this->travelTo(Carbon::create(2026, 8, 31, 12, 0, 0, 'UTC'));
|
||||||
|
|
||||||
|
// Act & Assert
|
||||||
|
$this->assertSame('February 2001', $this->localizationService->formatTimeGroupKey('2001-02', TimeEntryAggregationType::Month));
|
||||||
|
$this->assertSame('April 2026', $this->localizationService->formatTimeGroupKey('2026-04', TimeEntryAggregationType::Month));
|
||||||
|
$this->assertSame('December 2026', $this->localizationService->formatTimeGroupKey('2026-12', TimeEntryAggregationType::Month));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user