Skip to content

Commit

Permalink
Merge branch 'dev' into deploy
Browse files Browse the repository at this point in the history
  • Loading branch information
andre-dietrich committed Jul 8, 2023
2 parents c063a58 + 7606e5b commit a909eda
Show file tree
Hide file tree
Showing 34 changed files with 326 additions and 91 deletions.
59 changes: 45 additions & 14 deletions client/components/Settings.vue
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,26 @@
outlined
required
></v-text-field>

<v-text-field
v-model="logo"
label="Logo URL"
outlined
required
></v-text-field>

<v-textarea
v-model="description"
filled
label="Description"
auto-grow
></v-textarea>

<v-checkbox
v-model="selfAssign"
label="Enable self-assignment"
outlined
></v-checkbox>
</v-form>
</v-tab-item>
<v-tab-item>
Expand Down Expand Up @@ -125,7 +145,7 @@
<v-list-item-title>{{
scrapedModules[i].name
}}
<span style="display: inline-block; padding: 4px 8px; background-color: #424242; color: white; font-size: 12px; font-weight: bold; border-radius: 16px;">
<span style="display: inline-block; padding: 4px 8px; background-color: #424242; color: white; font-size: 12px; font-weight: bold; border-radius: 16px;">
{{scrapedModules[i].showInCustom}}
</span>
</v-list-item-title>
Expand All @@ -135,7 +155,7 @@
style="white-space: break-spaces"
>
</v-list-item-subtitle>

</v-list-item-content>

<v-list-item-action>
Expand Down Expand Up @@ -248,7 +268,7 @@
></v-textarea-->
</v-expansion-panel-content>
</v-expansion-panel>

<v-expansion-panel>
<v-expansion-panel-header>
Station Settings
Expand All @@ -273,7 +293,7 @@
></v-textarea-->
</v-expansion-panel-content>
</v-expansion-panel>

<v-expansion-panel>
<v-expansion-panel-header disable-icon-rotate>
Show in
Expand All @@ -289,7 +309,7 @@
></v-text-field>
</v-expansion-panel-content>
</v-expansion-panel>

</v-expansion-panels>
</v-menu>
</v-list-item-action>
Expand Down Expand Up @@ -556,7 +576,7 @@ import "prismjs/themes/prism-tomorrow.css"; // import syntax highlighting styles
import draggable from "vuedraggable";
function parseClassroom(config) {
let classroom
let classroom;
try {
classroom = JSON.parse(config);
Expand All @@ -571,7 +591,7 @@ function parseClassroom(config) {
if (classroom) {
// guarantees that older modules without a custom show can be loaded
for (let module of classroom.modules) {
module.showInCustom = module.showInCustom || module.showIn || ""
module.showInCustom = module.showInCustom || module.showIn || "";
}
}
Expand All @@ -589,6 +609,9 @@ export default {
memberTeacher: "",
memberStudent: "",
className: "",
logo: "",
description: "",
selfAssign: true,
saveError: false,
modules: [],
pageLoading: true,
Expand All @@ -614,6 +637,11 @@ export default {
return {
...this.$store.state.class_,
name: this.className,
meta: {
logo: this.logo,
description: this.description,
selfAssign: this.selfAssign,
},
members: {
teacher: this.strToList(this.memberTeacher),
student: this.strToList(this.memberStudent),
Expand All @@ -624,7 +652,7 @@ export default {
studentConfig: m.studentConfig,
teacherConfig: m.teacherConfig,
stationConfig: m.stationConfig,
showInCustom: m.showInCustom
showInCustom: m.showInCustom,
})),
};
},
Expand All @@ -643,9 +671,9 @@ export default {
async modules() {
const scrapedModules = [];
for (const m of this.modules) {
let scraped = await this.scrapeModule(m)
let scraped = await this.scrapeModule(m);
if (!m.showInCustom) {
m.showInCustom = scraped.shownIn.join(", ")
m.showInCustom = scraped.shownIn.join(", ");
}
scrapedModules.push(scraped);
Expand Down Expand Up @@ -705,8 +733,8 @@ export default {
const newClass = parseClassroom(res.target.result);
if (newClass) {
this.updateState(newClass);
this.restoreSuccess = this.updateState(newClass);
this.updateState(newClass);
this.restoreSuccess = this.updateState(newClass);
} else {
this.restoreSuccess = false;
this.saveError = true;
Expand Down Expand Up @@ -750,18 +778,21 @@ export default {
try {
class_ = class_ || this.$store.state.class_;
this.className = class_.name;
this.logo = class_?.meta?.logo || "";
this.description = class_?.meta?.description || "";
this.selfAssign = class_?.meta?.selfAssign || false;
this.memberTeacher = class_.members?.teacher.join("\n") || "";
this.memberStudent = class_.members?.student?.join("\n") || "";
this.modules =
[
...class_?.modules.map((m) => {
...class_?.modules.map((m) => {
return {
...m,
config: yaml.dump(m.config),
studentConfig: yaml.dump(m.studentConfig),
teacherConfig: yaml.dump(m.teacherConfig),
stationConfig: yaml.dump(m.stationConfig),
showInCustom : m.showInCustom
showInCustom: m.showInCustom,
};
}),
] || [];
Expand Down
187 changes: 186 additions & 1 deletion client/components/Student.vue
Original file line number Diff line number Diff line change
@@ -1,5 +1,120 @@
<template>
<div>
<v-navigation-drawer
:width="310"
:value="$store.state.drawer"
@input="(v) => $store.commit('toggleDrawer', v)"
app
clipped
v-show="selfAssign"
>
<v-list-item style="margin: 10px">
<v-list-item-content>
<v-list-item-title class="text-h6">
{{ $store.state.class_.name }}
</v-list-item-title>
<v-list-item-subtitle>
{{ liveStudentCount }}
{{ liveStudentCount == 1 ? "student" : "students" }},
{{ liveTeacherCount }}
{{ liveTeacherCount == 1 ? "teacher" : "teachers" }} online
</v-list-item-subtitle>
</v-list-item-content>
</v-list-item>
<v-list dense>
<v-list-item-group
:value="currentRoomName"
mandatory
>
<div
v-for="[room_name, room] in Object.entries(
liveClassProxy.rooms || {}
)"
:key="room_name"
:value="room_name"
>
<v-divider v-if="room_name != 'Teacher\'s Lounge'"></v-divider>
<v-hover v-slot="{ hover }">
<v-list-item
:value="room_name"
v-if="room_name != 'Teacher\'s Lounge'"
link
@click="
() => {
setCurrentRoom(room_name);
}
"
>
<v-list-item-icon style="margin-right: 15px">
<v-icon color="grey">
<template v-if="room_name == 'Lobby'">mdi-account-multiple</template>
<template v-else-if="room_name == 'PA Mode'">mdi-bullhorn</template>
<template v-else-if="room_name.startsWith('Station ')">mdi-router-wireless</template>
<template v-else>mdi-forum</template>
</v-icon>
</v-list-item-icon>

<v-list-item-title>{{ room_name }} </v-list-item-title>

<v-list-item-icon>
<v-icon color="grey">mdi-arrow-right</v-icon>
</v-list-item-icon>
</v-list-item>
</v-hover>

<v-list
dense
flat
>
<draggable
group="users"
@end="userRoomChange"
:id="`$ROOM:${room_name}`"
>
<v-hover
v-slot="{ hover }"
v-for="[email, user] in Object.entries(
liveClassProxy.users
).filter(([e, u]) => u.room == room_name)"
:key="email"
:id="`$EMAIL:${email}`"
>
<v-list-item
:disabled="email!=username"
inactive
:ripple="false"
:selectable="false"
v-show="room.userLinked != email"
>
<v-list-item-icon style="margin-right: 15px; margin-left: 20px">
<v-icon
v-if="user.role == 'student'"
color="grey"
>mdi-account-circle-outline</v-icon>
<v-icon
v-else-if="user.role == 'teacher'"
color="grey"
>mdi-clipboard-account-outline</v-icon>
</v-list-item-icon>
<v-list-item-title>
{{ user.displayName }}</v-list-item-title>

<v-icon
color="grey"
v-show="hover"
class="handle"
>mdi-drag-horizontal-variant</v-icon>
</v-list-item>
</v-hover>
</draggable>
</v-list>
</div>
</v-list-item-group>
</v-list>
</v-navigation-drawer>

<v-slide-y-transition> </v-slide-y-transition>

<v-container>
<div>
<v-row
Expand Down Expand Up @@ -28,24 +143,94 @@
</template>

<script>
import draggable from "vuedraggable";
import Module from "./Module.vue";
import Modules from "./Modules.vue";
import Settings from "./Settings.vue";
export default {
name: "Student",
props: ["liveClassProxy"],
computed: {
username() {
return this.$store.state.user.email;
},
roomName() {
return this.liveClassProxy.users[this.$store.state.user.email].room;
},
selfAssign() {
try {
return this.$store.state.class_.meta.selfAssign;
} catch (e) {}
return false;
},
},
watch: {
"$store.state.user.displayName"() {
if (this.$store.state.class_)
this.liveClassProxy.users[this.username].displayName =
this.$store.state.user.displayName;
},
currentRoomName() {
if (["md", "sm", "xs"].includes(this.$vuetify.breakpoint.name))
this.$store.commit("toggleDrawer", false);
},
liveClassProxy() {
this.updateDisplay();
},
},
methods: {
updateDisplay() {
this.liveTeacherCount = Object.values(this.liveClassProxy.users).filter(
(u) => u.role == "teacher"
).length;
this.liveStudentCount = Object.values(this.liveClassProxy.users).filter(
(u) => u.role == "student"
).length;
if (this.liveClassProxy && !this.ready) {
this.ready = true;
}
},
setCurrentRoom(room_name) {
this.liveClassProxy.users[this.username].room = room_name;
},
enableAutoAssign() {
this.liveClassProxy.autoAssign = this.username;
},
userRoomChange(e) {
if (e.type == "end") {
const room_name = e.to.id.replace("$ROOM:", "");
const user_email = e.item.id.replace("$EMAIL:", "");
if (user_email == this.username) {
this.setCurrentRoom(room_name);
}
}
},
},
data() {
return {
liveRoomProxy: {},
ready: false,
liveTeacherCount: 0,
liveStudentCount: 0,
lists: {},
myUrl: "",
};
},
async mounted() {
this.ready = true;
},
methods: {},
components: {
Settings,
Module,
draggable,
Modules,
},
};
</script>

Expand Down
5 changes: 5 additions & 0 deletions client/pages/class/_id.vue
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,11 @@ export default {
instance: this.$store.state.instance,
class_id: this.$route.params.id,
class_name: this.$store.state.class_.name,
meta: this.$store.state.class_?.meta || {
logo: "",
description: "",
selfAssign: false,
},
role: this.role,
},
...this.$store.state.user.memberships.filter(
Expand Down
Loading

0 comments on commit a909eda

Please sign in to comment.