-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add TipTap integration in PHP and Vue + Tera LandTask typescript sdk
- Loading branch information
1 parent
02f811c
commit aa5f39b
Showing
50 changed files
with
2,375 additions
and
243 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
/vendor/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
{ | ||
"name": "lychen/util-tiptap", | ||
"type": "library", | ||
"autoload": { | ||
"psr-4": { | ||
"Lychen\\UtilTiptap\\": "src/" | ||
} | ||
}, | ||
"authors": [ | ||
{ | ||
"name": "Nathan De Pachtere", | ||
"email": "[email protected]" | ||
} | ||
], | ||
"minimum-stability": "stable", | ||
"require": { | ||
"ueberdosis/tiptap-php": "1.4.*" | ||
}, | ||
"require-dev": { | ||
"zenstruck/foundry": "2.2.*" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
id: lychen-php-util-tiptap | ||
|
||
language: php | ||
|
||
type: library |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
<?php | ||
|
||
namespace Lychen\UtilTiptap\Service; | ||
|
||
use function Zenstruck\Foundry\faker; | ||
|
||
class TipTapFaker | ||
{ | ||
public static function randomContent(): ?array | ||
{ | ||
return faker()->boolean ? TipTapFaker::sentences() : TipTapFaker::paragraphs(); | ||
} | ||
|
||
public static function sentences($min = 1, $max = 3, $random = true): ?array | ||
{ | ||
return (!$random || faker()->boolean(70)) ? [ | ||
'type' => 'doc', | ||
'content' => [ | ||
[ | ||
'type' => 'paragraph', | ||
'content' => [ | ||
[ | ||
'type' => 'text', | ||
'text' => faker()->sentences(faker()->biasedNumberBetween($min, $max), asText: true), | ||
], | ||
], | ||
], | ||
], | ||
] : null; | ||
} | ||
|
||
public static function paragraphs($min = 1, $max = 3, $random = true): ?array | ||
{ | ||
return (!$random || faker()->boolean(70)) ? [ | ||
'type' => 'doc', | ||
'content' => [ | ||
[ | ||
'type' => 'paragraph', | ||
'content' => [ | ||
[ | ||
'type' => 'text', | ||
'text' => faker()->paragraph(faker()->biasedNumberBetween($min, $max)), | ||
], | ||
], | ||
], | ||
], | ||
] : null; | ||
} | ||
} |
53 changes: 53 additions & 0 deletions
53
libs/tera/land-task/ui-components/card-tera-land-task/CardTeraLandTask.vue
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
<template> | ||
<div | ||
class="p-4 rounded-3xl bg-surface-container-high text-on-surface-container flex flex-row gap-4 justify-between items-center active:bg-surface-container-highest" | ||
> | ||
<div class="flex flex-col gap-1"> | ||
<span class="whitespace-nowrap overflow-hidden text-ellipsis text-sm" | ||
>{{ landTask.title }} | ||
</span> | ||
<span | ||
v-if="landTask.startDate || landTask.dueDate" | ||
class="opacity-70 text-xs" | ||
> | ||
{{ | ||
landTask.startDate && !landTask.dueDate | ||
? 'Débute le' | ||
: !landTask.startDate && landTask.dueDate | ||
? 'Dû le' | ||
: 'Du' | ||
}} | ||
<span v-if="landTask.startDate">{{ d(landTask.startDate, 'short') }}</span> | ||
{{ landTask.startDate && landTask.dueDate ? 'au' : '' }} | ||
<span | ||
v-if="landTask.dueDate" | ||
:class="{ 'text-negative': overdue }" | ||
>{{ d(landTask.dueDate, 'short') }}</span | ||
> | ||
</span> | ||
</div> | ||
</div> | ||
</template> | ||
|
||
<script generic="T extends Land" lang="ts" setup> | ||
import type { Land } from '@lychen/tera-util-api-sdk/model/Land'; | ||
import { computed, defineAsyncComponent } from 'vue'; | ||
import { messages, TRANSLATION_KEY } from '@lychen/tera-land-ui-i18n/property'; | ||
import { useI18nExtended } from '@lychen/vue-i18n-util-composables/useI18nExtended'; | ||
import { VARIANT, type Variant } from '.'; | ||
import type { LandTask } from '@lychen/tera-util-api-sdk/model/LandTask'; | ||
const LychenIcon = defineAsyncComponent(() => import('@lychen/ui-components/icon/LychenIcon.vue')); | ||
const { variant = VARIANT.Default, landTask } = defineProps<{ | ||
landTask: Required<Pick<LandTask, 'title' | 'content' | 'dueDate' | 'startDate'>>; | ||
variant?: Variant; | ||
}>(); | ||
const { t, d } = useI18nExtended({ messages, rootKey: TRANSLATION_KEY, prefixed: true }); | ||
const overdue = computed<boolean>(() => { | ||
return new Date(landTask.dueDate) < new Date(); | ||
}); | ||
</script> |
7 changes: 7 additions & 0 deletions
7
libs/tera/land-task/ui-components/card-tera-land-task/index.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
import type { ObjectValues } from '@lychen/typescript-util-object/Object'; | ||
|
||
export const VARIANT = { | ||
Default: 'default', | ||
} as const; | ||
|
||
export type Variant = ObjectValues<typeof VARIANT>; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
dependsOn: | ||
- tera-land-task-ui-i18n | ||
- tera-util-api-sdk | ||
- typescript-util-object | ||
- ui-components | ||
|
||
id: tera-land-task-ui-components | ||
language: typescript | ||
type: library |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
{ | ||
"name": "@lychen/tera-land-task-ui-components", | ||
"version": "0.0.0", | ||
"license": "UNLICENSED", | ||
"dependencies": { | ||
"@lychen/tera-land-task-ui-i18n": "workspace:*", | ||
"@lychen/tera-util-api-sdk": "workspace:*", | ||
"@lychen/typescript-util-object": "workspace:*", | ||
"@lychen/ui-components": "workspace:*" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
{ | ||
"extends": "../../../../tsconfig.options.json", | ||
"include": [ | ||
"../../../typescript/util-object/**/*", | ||
"../../../ui-components/**/*", | ||
"../../util-api-sdk/**/*", | ||
"../ui-i18n/**/*", | ||
"**/*" | ||
], | ||
"references": [ | ||
{ | ||
"path": "../../../typescript/util-object" | ||
}, | ||
{ | ||
"path": "../../../ui-components" | ||
}, | ||
{ | ||
"path": "../../util-api-sdk" | ||
}, | ||
{ | ||
"path": "../ui-i18n" | ||
} | ||
], | ||
"compilerOptions": { | ||
"outDir": "../../../../.moon/cache/types/libs/tera/land-task/ui-components", | ||
"paths": { | ||
"@lychen/ui-components/*": ["../../../ui-components/*"], | ||
"@lychen/tera-util-api-sdk/*": ["../../util-api-sdk/*"], | ||
"@lychen/typescript-util-object/*": ["../../../typescript/util-object/*"], | ||
"@lychen/tera-land-task-ui-i18n/*": ["../ui-i18n/*"] | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
id: tera-land-task-ui-i18n | ||
language: typescript | ||
type: library |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
{ | ||
"name": "@lychen/tera-land-task-ui-i18n", | ||
"version": "0.0.0", | ||
"license": "UNLICENSED" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
export default { | ||
land_areas: { | ||
default: 'no area | 1 area | {count} areas', | ||
}, | ||
kind: { | ||
label: 'Type of space', | ||
individual: { | ||
default: 'Individual', | ||
}, | ||
market_garden: { | ||
default: 'Market garden', | ||
}, | ||
shared_garden: { | ||
default: 'Shared garden', | ||
}, | ||
}, | ||
surface: { | ||
label: 'Surface area', | ||
suffix: 'in m²', | ||
default: '{count} m²', | ||
}, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
export default { | ||
land_areas: { | ||
default: 'aucune zone | 1 zone | {count} zones', | ||
}, | ||
kind: { | ||
label: "Type d'espace", | ||
individual: { | ||
default: 'Particulier', | ||
}, | ||
market_garden: { | ||
default: 'Maraîcher', | ||
}, | ||
shared_garden: { | ||
default: 'Jardin partagé', | ||
}, | ||
}, | ||
surface: { | ||
label: 'Surface', | ||
suffix: 'en m²', | ||
default: '{count} m²', | ||
}, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
import enUs from './en-US'; | ||
import frFr from './fr-FR'; | ||
|
||
export const messages = { | ||
'fr-FR': frFr, | ||
'en-US': enUs, | ||
'en-GB': enUs, | ||
}; | ||
|
||
export const TRANSLATION_KEY = 'lychen_tera_land_property'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
{ | ||
"extends": "../../../../tsconfig.options.json", | ||
"include": ["**/*"], | ||
"references": [], | ||
"compilerOptions": { | ||
"outDir": "../../../../.moon/cache/types/libs/tera/land-task/ui-i18n", | ||
"paths": {} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
id: tera-land-task-util-composables | ||
language: typescript | ||
type: library |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
{ | ||
"extends": "../../../../tsconfig.options.json", | ||
"include": ["**/*"], | ||
"references": [], | ||
"compilerOptions": { | ||
"outDir": "../../../../.moon/cache/types/libs/tera/land-task/util-composables", | ||
"paths": {} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import type { Resource } from '@lychen/typescript-util-json-ld-hydra/types/Resource'; | ||
import { instanceOfResource } from '@lychen/typescript-util-json-ld-hydra/types/Resource'; | ||
|
||
export interface LandTask extends Resource { | ||
'@type': 'LandTask'; | ||
title: string; | ||
content?: JSON; | ||
dueDate?: string; | ||
startDate?: string; | ||
} | ||
|
||
export function instanceOfLandTask(object: unknown): object is LandTask { | ||
if (!instanceOfResource(object)) { | ||
return false; | ||
} | ||
|
||
return object['@type'] === 'LandTask'; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
import { Repository } from '@lychen/typescript-util-api/classes/Repository'; | ||
import axiosInstance from '@lychen/typescript-util-api/ZitadelBearerTokenAxiosInstance'; | ||
import type { Resource } from '@lychen/typescript-util-json-ld-hydra/types/Resource'; | ||
import type { LandTask } from '../model/LandTask'; | ||
|
||
class LandTaskRepository<T extends Resource = LandTask> extends Repository<T> {} | ||
|
||
export default new LandTaskRepository(axiosInstance, 'land_tasks'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export type OrNullUndefined<T> = T | null | undefined; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
id: typescript-util-types | ||
language: typescript | ||
type: library |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
{ | ||
"name": "@lychen/typescript-util-types", | ||
"version": "0.0.0", | ||
"license": "UNLICENSED" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
{ | ||
"extends": "../../../tsconfig.options.json", | ||
"include": ["**/*"], | ||
"references": [], | ||
"compilerOptions": { | ||
"outDir": "../../../.moon/cache/types/libs/typescript/util-types", | ||
"paths": {} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export type NoStylingProps = { noStyling?: boolean }; |
Oops, something went wrong.