Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(frontend): show open rooms sidebar #1273

Merged
merged 2 commits into from
Jul 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
70 changes: 47 additions & 23 deletions frontend/.storybook/ApolloWrapper.vue
Original file line number Diff line number Diff line change
Expand Up @@ -3,30 +3,54 @@
</template>

<script lang="ts">
import { defineComponent, provide } from 'vue'
import { DefaultApolloClient } from '@vue/apollo-composable'
import { defineComponent, provide } from 'vue'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unintended indent change?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I noticed that /storybook is in .eslintignore, I don't see why and suggest we change it.

import { DefaultApolloClient } from '@vue/apollo-composable'

import { joinMyRoomMutation } from '#mutations/joinMyRoomMutation'
import { MockedProvider } from '@apollo/client/testing'
import { joinMyRoomMutation } from '#mutations/joinMyRoomMutation'
import { openRoomsQuery } from '#src/graphql/queries/openRoomsQuery'
import { MockedProvider } from '@apollo/client/testing'

const apolloClient = new MockedProvider({
mocks: [
{
request: {
query: joinMyRoomMutation,
},
result: {
data: {
joinMyRoom: 'https://meet.jit.si/room',
},
},
},
],
})
const apolloClient = new MockedProvider({
mocks: [
{
request: {
query: joinMyRoomMutation,
},
result: {
data: {
joinMyRoom: 'https://meet.jit.si/room',
},
},
},
{
request: {
query: openRoomsQuery,
},
result: {
data: {
openRooms: [
{
meetingID: 'my-meeting',
meetingName: 'my meeting',
startTime: '1234',
participantCount: 1,
attendees: [
{
fullName: 'Peter Lustig',
},
],
joinLink: 'https://my.link',
},
]
},
},
},
],
})

export default defineComponent({
setup() {
provide(DefaultApolloClient, apolloClient)
},
})
export default defineComponent({
setup() {
provide(DefaultApolloClient, apolloClient)
},
})
</script>
10 changes: 10 additions & 0 deletions frontend/scripts/tests/mock.apolloClient.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,19 @@
import { DefaultApolloClient } from '@vue/apollo-composable'
import { config } from '@vue/test-utils'
import { createMockClient } from 'mock-apollo-client'
import { vi } from 'vitest'

import { openRoomsQuery } from '#src/graphql/queries/openRoomsQuery'

export const mockClient = createMockClient()

export const openRoomsQueryMock = vi.fn()

mockClient.setRequestHandler(
openRoomsQuery,
openRoomsQueryMock.mockResolvedValue({ data: { openRooms: [] } }),
)

config.global.provide = {
...config.global.provide,
[DefaultApolloClient]: mockClient,
Expand Down
40 changes: 38 additions & 2 deletions frontend/src/components/menu/BottomMenu.vue
Original file line number Diff line number Diff line change
@@ -1,8 +1,15 @@
<template>
<div class="navigation-drawer-box d-md-none d-lg-none position-fixed mb-5 pb-5">
Elweyn marked this conversation as resolved.
Show resolved Hide resolved
<ListWithNavigationDrawer
:drawer="drawer"
:location="location"
@update:drawer="updateDrawer($event)"
/>
</div>
<div
class="bottom-menu d-flex w-100 position-fixed bottom-0 justify-space-around align-center py-2 bg-surface"
class="bottom-menu d-flex w-100 position-fixed bottom-0 justify-space-around align-center py-2 bg-surface d-md-none d-lg-none"
Elweyn marked this conversation as resolved.
Show resolved Hide resolved
>
<Circle class="camera-button">
<Circle class="camera-button" @click="toggleDrawer">
<v-icon icon="$camera"></v-icon>
</Circle>
Elweyn marked this conversation as resolved.
Show resolved Hide resolved
<CreateButtonMobile />
Expand All @@ -11,10 +18,22 @@
</template>

<script lang="ts" setup>
import { ref } from 'vue'

import CreateButtonMobile from '#components/buttons/CreateButtonMobile.vue'
import ListWithNavigationDrawer from '#components/vuetify/Organisms/ListWithNavigationDrawer.vue'

import Circle from './CircleElement.vue'
import UserInfo from './UserInfo.vue'

const drawer = ref(false)
const toggleDrawer = () => {
drawer.value = !drawer.value
}
const updateDrawer = (value: boolean) => {
drawer.value = value
}
const location = ref<'bottom' | 'right' | 'left' | 'end' | 'top' | 'start'>('bottom')
</script>

<style scoped lang="scss">
Expand All @@ -30,4 +49,21 @@ import UserInfo from './UserInfo.vue'
transform: translateX(20px);
}
}

.create-button-mobile {
z-index: 1;
transform: translate(20px, 30px);
}
Comment on lines +53 to +56
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, I think this should not be here.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You are right if this is needed it should be in an own PR.


.navigation-drawer-box {
bottom: 65px;
}

.v-navigation-drawer {
scrollbar-width: thin;
}

.v-navigation-drawer__content {
scrollbar-width: thin;
}
</style>
20 changes: 18 additions & 2 deletions frontend/src/components/menu/TopMenu.vue
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
<LightDarkSwitch class="d-none d-lg-flex" />
</v-col>
<v-col class="d-flex align-center justify-end">
<Circle>
<Circle @click="toggleDrawer">
<v-icon icon="$camera"></v-icon>
</Circle>
Elweyn marked this conversation as resolved.
Show resolved Hide resolved
<UserInfo class="ml-2" />
Expand All @@ -26,19 +26,34 @@
</v-row>
</v-app-bar>
</div>
<ListWithNavigationDrawer :drawer="drawer" :location="location" @update:drawer="updateDrawer" />
Elweyn marked this conversation as resolved.
Show resolved Hide resolved
</template>

<script lang="ts" setup>
import { ref } from 'vue'

import ListWithNavigationDrawer from '#components/vuetify/Organisms/ListWithNavigationDrawer.vue'

import Circle from './CircleElement.vue'
import LightDarkSwitch from './LightDarkSwitch.vue'
import LogoImage from './LogoImage.vue'
import TabControl from './TabControl.vue'
import UserInfo from './UserInfo.vue'

const drawer = ref(false)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"Just" naming, but I have a strong preference for isDrawerVisible, or maybe showDrawer. I figured that Vuetify internally calls this drawer as well, but that doesn't make it a better name imo.

const toggleDrawer = () => {
drawer.value = !drawer.value
}
const updateDrawer = (value: boolean) => {
drawer.value = value
}
Comment on lines +44 to +49
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could be refactored into a composable useDrawer or something more general.

const location = ref<'bottom' | 'right' | 'left' | 'end' | 'top' | 'start'>('right')
</script>

<style scoped lang="scss">
.app-bar {
position: static !important;
position: sticky;
top: 0;
Elweyn marked this conversation as resolved.
Show resolved Hide resolved
background: transparent !important;
}

Expand All @@ -49,5 +64,6 @@ import UserInfo from './UserInfo.vue'
.top-menu {
position: sticky;
top: 0;
z-index: 1000;
Elweyn marked this conversation as resolved.
Show resolved Hide resolved
}
</style>
126 changes: 124 additions & 2 deletions frontend/src/components/menu/__snapshots__/BottomMenu.test.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,129 @@ exports[`BottomMenu > renders BottomMenu 1`] = `
class="v-application__wrap"
>


<div
class="navigation-drawer-box d-md-none d-lg-none position-fixed mb-5 pb-5"
data-v-96a196cc=""
>

<nav
class="v-navigation-drawer v-navigation-drawer--bottom v-navigation-drawer--temporary v-theme--light v-navigation-drawer--mobile menu-drawer-top"
data-v-3308ee86=""
style="bottom: 0px; z-index: 1004; transform: translateY(110%); position: fixed; transition: none !important; left: 0px; width: calc(100% - 0px - 0px);"
>
<!---->
<!---->
<div
class="v-navigation-drawer__content"
>

<!--
&lt;SearchField
v-model="search"
label="Open Tables, Jobs"
prepend-inner-icon="mdi-tune"
&gt;&lt;/SearchField&gt;
-->
<div
class="v-list v-theme--light bg-transparent v-list--density-default v-list--one-line"
data-v-3308ee86=""
role="listbox"
tabindex="0"
>

<div
class="mx-4"
data-v-3308ee86=""
>
$t('menu.roomList')
</div>
<div
class="v-card v-theme--light v-card--density-default v-card--variant-elevated mx-auto"
data-v-3308ee86=""
data-v-fd6c8fbc=""
style="width: 400px;"
>
<!---->
<div
class="v-card__loader"
>
<div
aria-hidden="true"
aria-valuemax="100"
aria-valuemin="0"
class="v-progress-linear v-theme--light v-locale--is-ltr"
role="progressbar"
style="top: 0px; height: 0px; --v-progress-linear-height: 2px;"
>
<!---->
<div
class="v-progress-linear__background"
style="width: 100%;"
/>
<transition-stub
appear="false"
css="true"
name="fade-transition"
persisted="false"
>
<div
class="v-progress-linear__indeterminate"
>

<div
class="v-progress-linear__indeterminate long"
/>
<div
class="v-progress-linear__indeterminate short"
/>

</div>
</transition-stub>
<!---->
</div>
</div>
<!---->
<!---->

<div
class="v-list v-theme--light bg-transparent v-list--density-default v-list--two-line"
data-v-fd6c8fbc=""
role="listbox"
tabindex="0"
>




</div>

<!---->

<!---->
<span
class="v-card__underlay"
/>

</div>

</div>

</div>
<!---->
</nav>
<transition-stub
appear="false"
css="true"
name="fade-transition"
persisted="false"
>
<!---->
</transition-stub>

</div>
<div
class="bottom-menu d-flex w-100 position-fixed bottom-0 justify-space-around align-center py-2 bg-surface"
class="bottom-menu d-flex w-100 position-fixed bottom-0 justify-space-around align-center py-2 bg-surface d-md-none d-lg-none"
data-v-96a196cc=""
>
<div
Expand Down Expand Up @@ -539,7 +660,7 @@ exports[`BottomMenu > renders BottomMenu 1`] = `
<button
aria-expanded="false"
aria-haspopup="menu"
aria-owns="v-menu-0"
aria-owns="v-menu-1"
class="user-info rounded-pill d-flex flex-row text-icon border-sm align-center justify-center"
data-v-607bdd70=""
targetref="[object Object]"
Expand Down Expand Up @@ -595,6 +716,7 @@ exports[`BottomMenu > renders BottomMenu 1`] = `

</div>


</div>
</div>
`;
Loading