Skip to content

Commit

Permalink
build(deps): bump @gip-recia/tldraw-webcomponent from 1.5.1 to 1.6.0
Browse files Browse the repository at this point in the history
  • Loading branch information
Quentin-Guillemin committed Jan 26, 2024
1 parent 8ee12f6 commit dc39dac
Show file tree
Hide file tree
Showing 8 changed files with 358 additions and 13 deletions.
2 changes: 2 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ VITE_BASE_URI="/"
VITE_API_URI="/"
VITE_AXIOS_TIMEOUT=10000

VITE_WEBSOCKET_API_URL=""

VITE_USER_INFO_API_URI=""

VITE_PROXY_API_URL="http://localhost:8090"
2 changes: 2 additions & 0 deletions .env.production
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,6 @@ VITE_BASE_URI="/collabsoft"
VITE_API_URI="/collabsoft"
VITE_AXIOS_TIMEOUT=10000

VITE_WEBSOCKET_API_URL=""

VITE_USER_INFO_API_URI="/portail/api/v5-1/userinfo?claims=private&groups="
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
"release:major": "standard-version --release-as major"
},
"dependencies": {
"@gip-recia/tldraw-webcomponent": "^1.5.1",
"@gip-recia/tldraw-webcomponent": "^1.6.0",
"@vueuse/core": "^10.7.2",
"pinia": "^2.1.7",
"vue": "^3.4.15",
Expand Down
3 changes: 3 additions & 0 deletions src/main/webapp/src/stores/configurationStore.ts
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,8 @@ export const useConfigurationStore = defineStore('configuration', () => {

const isJoin = ref<boolean>(false);

const isWsOk = ref<boolean>(true);

/* -- Gestion de l'affichage -- */

const isGrid = ref<boolean>(false);
Expand Down Expand Up @@ -141,6 +143,7 @@ export const useConfigurationStore = defineStore('configuration', () => {
isNew,
resetState,
isJoin,
isWsOk,
isGrid,
isSettings,
};
Expand Down
32 changes: 30 additions & 2 deletions src/main/webapp/src/views/app/tldraw/JoinTldrawView.vue
Original file line number Diff line number Diff line change
@@ -1,11 +1,32 @@
<script setup lang="ts">
import { useConfigurationStore } from '@/stores/configurationStore.ts';
import { watchOnce } from '@vueuse/core';
import { storeToRefs } from 'pinia';
import { onMounted, onUnmounted } from 'vue';
import { useRoute, useRouter } from 'vue-router';
import { useTheme } from 'vuetify';
const { VITE_USER_INFO_API_URI } = import.meta.env;
const configurationStore = useConfigurationStore();
const { isWsOk } = storeToRefs(configurationStore);
const { VITE_WEBSOCKET_API_URL, VITE_USER_INFO_API_URI } = import.meta.env;
const route = useRoute();
const router = useRouter();
const theme = useTheme();
const joinCode: string = route.params.joinCode != undefined ? (route.params.joinCode as string) : '';
watchOnce(
isWsOk,
(newValue, oldValue) => {
if (newValue != oldValue && !newValue) {
router.go(0);
}
},
{ immediate: true },
);
const styleObserver = new MutationObserver((mutationList: Array<MutationRecord>) => {
for (const mutation of mutationList) {
if (mutation.type === 'attributes' && mutation.attributeName === 'style') {
Expand All @@ -20,9 +41,16 @@ onMounted(() => {
onUnmounted(() => {
styleObserver.disconnect();
isWsOk.value = false;
});
</script>

<template>
<tldraw-editor :user-info-api-url="VITE_USER_INFO_API_URI" :dark-mode="theme.global.name.value == 'dark'" />
<tldraw-multiplayer
v-if="isWsOk"
:websocket-api-url="VITE_WEBSOCKET_API_URL"
:room-id="joinCode"
:user-info-api-url="VITE_USER_INFO_API_URI"
:dark-mode="theme.global.name.value == 'dark'"
/>
</template>
2 changes: 1 addition & 1 deletion src/main/webapp/src/views/app/tldraw/TldrawView.vue
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ onUnmounted(() => {
</script>

<template>
<tldraw-editor
<tldraw-singleplayer
v-if="currentFile"
:persistance-api-url="`${VITE_API_URI}/api/file/${currentFile.id}`"
:assets-api-url="`${VITE_API_URI}/api/file/${currentFile.id}/resource`"
Expand Down
7 changes: 6 additions & 1 deletion vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,12 @@ export default ({ mode }: { mode: string }) => {
template: {
compilerOptions: {
isCustomElement: (tag) =>
['extended-uportal-header', 'extended-uportal-footer', 'tldraw-editor'].includes(tag),
[
'extended-uportal-header',
'extended-uportal-footer',
'tldraw-singleplayer',
'tldraw-multiplayer',
].includes(tag),
},
},
}),
Expand Down
Loading

0 comments on commit dc39dac

Please sign in to comment.