feat: interactive course poll (#5)
* CLASSROOMIO-T-218:Made the save button to be at the bottom right * CLASSROOMIO-T-218:Removed unused class * CLASSROOMIO-T-119:Made poll to be created by teachers only * CLASSROOMIO-T-119:Updated the interface * CLASSROOMIO-T-218:Made the save button to be at the bottom right * CLASSROOMIO-T-218:Removed unused class * CLASSROOMIO-T-119:Made poll to be created by teachers only * CLASSROOMIO-T-119:Updated the interface * polls improvements * CLASSROOMIO-T-119:Made some corrections to the store * fix types * poll imporvements * CLASSROOMIO-T-119: Connect create/delete poll to backend * remove console * CLASSROOMIO-T-119: Improve hotkeys + better abstract poll feature * realtime poll --------- Co-authored-by: emmanuel <ifeanyi@digdippa.com>
This commit is contained in:
committed by
GitHub
co-authored by
emmanuel
parent
b4587483fb
commit
465b2341fd
@@ -0,0 +1,52 @@
|
||||
<script lang="ts">
|
||||
import { onMount } from 'svelte';
|
||||
import { sideBar } from '$lib/components/Org/store';
|
||||
import { apps } from '$lib/components/Apps/store';
|
||||
import APPS_CONSTANTS from '$lib/components/Apps/constants';
|
||||
import hotkeys from 'hotkeys-js';
|
||||
|
||||
function handleClose() {
|
||||
$apps.selectedApp = undefined;
|
||||
if ($apps.isStudent) {
|
||||
$apps.open = false;
|
||||
}
|
||||
}
|
||||
|
||||
function handleAppClick(appName?: string) {
|
||||
if (appName === $apps.selectedApp) {
|
||||
handleClose();
|
||||
} else {
|
||||
$apps.selectedApp = appName;
|
||||
}
|
||||
$apps.open = true;
|
||||
$apps.dropdown = !$apps.dropdown;
|
||||
}
|
||||
|
||||
function toggleSidebar() {
|
||||
$sideBar.hidden = !$sideBar.hidden;
|
||||
}
|
||||
|
||||
onMount(() => {
|
||||
hotkeys('ctrl+b,command+b,ctrl+1,command+1,ctrl+2,command+2', function (event, handler) {
|
||||
// Prevent default behavior
|
||||
event.preventDefault();
|
||||
|
||||
switch (handler.key) {
|
||||
case 'ctrl+b':
|
||||
case 'command+b':
|
||||
toggleSidebar();
|
||||
break;
|
||||
case 'ctrl+1':
|
||||
case 'command+1':
|
||||
handleAppClick(APPS_CONSTANTS.APPS.COMMENTS);
|
||||
break;
|
||||
case 'ctrl+2':
|
||||
case 'command+2':
|
||||
handleAppClick(APPS_CONSTANTS.APPS.POLL);
|
||||
break;
|
||||
}
|
||||
});
|
||||
});
|
||||
</script>
|
||||
|
||||
<slot />
|
||||
Reference in New Issue
Block a user