Skip to content

Commit e07c336

Browse files
authored
Merge pull request #453 from CodingFactory-Repos/develop-G10
[Feature] Add Emojis to the tchat
2 parents ca69613 + f773921 commit e07c336

10 files changed

Lines changed: 268 additions & 147 deletions

File tree

back-end/package-lock.json

Lines changed: 126 additions & 126 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

back-end/package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,6 @@
4747
"pug": "^3.0.2",
4848
"reflect-metadata": "^0.1.13",
4949
"rimraf": "^5.0.1",
50-
"sharp": "^0.32.1",
5150
"rxjs": "^7.8.1",
5251
"sharp": "^0.32.1",
5352
"socket.io": "^4.6.1"

back-end/src/base/calls/calls.controller.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,4 +129,11 @@ export class CallsController {
129129
async isProductOwner(@Jwt() userId: ObjectId, @Res() res: Response) {
130130
return res.status(201).json({ isProductOwner: true });
131131
}
132+
133+
@Get('/is_pedagogue')
134+
@UseGuards(JwtAuthGuard, new RoleValidator(Roles.PEDAGOGUE))
135+
async IsPedagogue(@Jwt() userId: ObjectId, @Res() res: Response) {
136+
console.log(Roles.PEDAGOGUE);
137+
return res.status(201).json({ isPedagogue: true });
138+
}
132139
}

front-end/package-lock.json

Lines changed: 65 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

front-end/package.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
},
1414
"dependencies": {
1515
"@imengyu/vue3-context-menu": "^1.2.10",
16+
"@picmo/popup-picker": "^5.8.4",
1617
"@pixi/graphics-smooth": "^1.1.0",
1718
"@toycode/markdown-it-class": "^1.2.4",
1819
"@vitejs/plugin-vue-jsx": "^3.0.1",
@@ -32,6 +33,7 @@
3233
"marked": "^5.0.5",
3334
"mavon-editor": "^3.0.1",
3435
"pdfmake": "^0.2.7",
36+
"picmo": "^5.8.4",
3537
"pinia": "^2.1.3",
3638
"pixi-viewport": "^5.0.1",
3739
"pixi.js": "^7.2.4",
@@ -50,6 +52,7 @@
5052
"vue-qrcode-reader": "^3.1.6",
5153
"vue-qrious": "^3.1.0",
5254
"vue-router": "^4.2.2",
55+
"vue3-emoji-picker": "^1.1.7",
5356
"vuedraggable": "^4.1.0",
5457
"vuejs3-datepicker": "^1.0.19"
5558
},

front-end/src/components/RollCallComponents/CallsComponent.vue

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
<template>
22
<div class="flex flex-col items-center mt-2.5">
3-
<!-- PUT A FRAME AROUND THE QRCODE TO MAKE IT PRETTIER -->
4-
<div v-if="url" class="border-4 border-white dark:border-gray-700 rounded-lg bg-white dark:bg-gray-700 p-4">
3+
<div
4+
v-if="url"
5+
class="border-4 border-white dark:border-gray-700 rounded-lg bg-white dark:bg-gray-700 p-4"
6+
>
57
<qrcode :value="url" />
68
</div>
79
<div v-else>
@@ -69,6 +71,12 @@ export default {
6971
this.getQrCode();
7072
}
7173
this.message = response.data.message;
74+
this.isPedago(response.data.message);
75+
},
76+
isPedago(message) {
77+
if (message.includes('pédagogue')) {
78+
this.$router.push('/');
79+
}
7280
},
7381
},
7482
};

front-end/src/components/RollCallComponents/Chat.vue

Lines changed: 25 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,7 @@
1313
</div>
1414
<div class="chatbox_input flex-col w-full absolute bottom-2">
1515
<div class="w-full">
16-
<div
17-
class="gif-container h-[400px] flex z-10 w-[400px] mt-64 overflow-y-scroll"
18-
>
16+
<div class="gif-container h-[400px] flex z-10 w-[400px] mt-64 overflow-y-scroll">
1917
<div class="flex flex-wrap justify-center">
2018
<img
2119
v-for="gif in gifs"
@@ -27,12 +25,21 @@
2725
/>
2826
</div>
2927
</div>
28+
<div
29+
ref="emojiContainer"
30+
v-if="showEmoji"
31+
class="place-items-start ease-in-out transition-all duration-300"
32+
onfocusout="showEmoji()"
33+
>
34+
<EmojiPicker :native="true" class="!mr-0 !ml-0" @select="(event) => addEmoji(event)" />
35+
</div>
36+
<button class="emojiBtn w-1/12 h-1/12" @click="displayEmoji()" ref="emojiBtn">😄</button>
3037
<input
3138
v-model="newMessageText"
3239
@keydown.enter="sendMessage"
3340
placeholder="Envoyer un message"
3441
:class="{
35-
'w-9/12': !gifSelected,
42+
'w-8/12': !gifSelected,
3643
'w-3/12': gifSelected,
3744
'p-2': true,
3845
'bg-white': true,
@@ -58,7 +65,7 @@
5865
placeholder="Gif"
5966
:class="{
6067
'w-3/12': !gifSelected,
61-
'w-9/12': gifSelected,
68+
'w-8/12': gifSelected,
6269
'p-2': true,
6370
'bg-white': true,
6471
'dark:bg-gray-700': true,
@@ -90,6 +97,8 @@ import axios, { AxiosError } from 'axios';
9097
import { manager } from '@/api/network/socket.io';
9198
import { http } from '@/api/network/axios';
9299
import { withErrorHandler } from '@/utils/storeHandler';
100+
import EmojiPicker from 'vue3-emoji-picker';
101+
import 'vue3-emoji-picker/css';
93102
94103
const props = defineProps<{
95104
roomId: string;
@@ -105,9 +114,10 @@ const gifs = ref([]);
105114
const newMessageText = ref('');
106115
const courseId = ref();
107116
const count = ref();
108-
const hoverHint = ref(false);
109117
const gifSelected = ref(false);
110118
const searchTimeout = ref(null);
119+
const showEmoji = ref(false);
120+
const emojiContainer = ref();
111121
112122
/* SOCKET */
113123
@@ -133,6 +143,15 @@ onUnmounted(() => {
133143
134144
/* METHODS */
135145
146+
const addEmoji = (selection) => {
147+
console.log(selection.i);
148+
newMessageText.value += selection.i;
149+
};
150+
151+
const displayEmoji = () => {
152+
showEmoji.value = !showEmoji.value;
153+
};
154+
136155
const addMessage = (msg: Object) => {
137156
messages.value.unshift(msg);
138157
};

front-end/src/components/RollCallComponents/MakeGroupsComponent.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
<template>
22
<div v-if="courseId" class="mx-auto">
3-
<a :href="groupUrl">
3+
<router-link :to="groupUrl">
44
<button class="bg-blue-500 text-white py-2 px-4 rounded mt-2 mb-4">Former les groupes</button>
5-
</a>
5+
</router-link>
66
</div>
77
</template>
88

front-end/src/components/RollCallComponents/ReturnButtonComponent.vue

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,11 @@
88
</template>
99

1010
<script setup>
11+
import { useRouter } from 'vue-router';
12+
13+
const router = useRouter();
14+
1115
const goBack = () => {
12-
window.history.back();
16+
router.go(-1);
1317
};
1418
</script>

front-end/src/layout/app/DrawerLayout.vue

Lines changed: 25 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -63,14 +63,16 @@
6363
}"
6464
/>
6565
</DrawerRouterOption>
66-
<DrawerRouterOption to="/app/rollcall" name="Attendance" :fold="!active">
67-
<SvgQrCode
68-
:class="{
69-
'fill-selected-icon dark:fill-selected-icon':
70-
route.path.startsWith('/app/rollcall'),
71-
}"
72-
/>
73-
</DrawerRouterOption>
66+
<div v-if="!isPedago">
67+
<DrawerRouterOption to="/app/rollcall" name="Attendance" :fold="!active">
68+
<SvgQrCode
69+
:class="{
70+
'fill-selected-icon dark:fill-selected-icon':
71+
route.path.startsWith('/app/rollcall'),
72+
}"
73+
/>
74+
</DrawerRouterOption>
75+
</div>
7476
<DrawerRouterOption to="/app/retrospective" name="Retrospective" :fold="!active">
7577
<SvgNote
7678
:class="{
@@ -118,7 +120,7 @@
118120
</template>
119121

120122
<script lang="ts" setup>
121-
import { computed, ref } from 'vue';
123+
import { computed, onMounted, ref } from 'vue';
122124
import { useRoute } from 'vue-router';
123125
124126
import { useThemeStore } from '@/store/modules/theme.store';
@@ -138,6 +140,7 @@ import SvgNote from '@/components/common/svg/Note.vue';
138140
import SvgDark from '@/components/common/svg/Dark.vue';
139141
import SvgLight from '@/components/common/svg/Light.vue';
140142
import SvgLogout from '@/components/common/svg/Logout.vue';
143+
import { http } from '@/api/network/axios';
141144
142145
const route = useRoute();
143146
const themeStore = useThemeStore();
@@ -149,6 +152,19 @@ const isBlacklist = computed(() => blacklist.some((rgx) => rgx.test(route.path))
149152
const theme = computed(() => themeStore.theme);
150153
const active = ref(false);
151154
const modalLogoutActive = ref(false);
155+
const isPedago = ref(false);
156+
157+
onMounted(async () => {
158+
await getIsPedago();
159+
});
160+
161+
const getIsPedago = async () => {
162+
try {
163+
isPedago.value = await http.get(`/calls/is_pedagogue/`);
164+
} catch (error) {
165+
console.log(error);
166+
}
167+
};
152168
153169
const drawerAction = () => {
154170
active.value = !active.value;

0 commit comments

Comments
 (0)