Skip to content
Snippets Groups Projects
Commit 1a7359e3 authored by Erik Borgeteien Hansen's avatar Erik Borgeteien Hansen
Browse files

finished

parent 929aabe9
No related branches found
No related tags found
1 merge request!63Community popup
Pipeline #178397 passed
<template> <template>
<NotificationModal <CustomFooterModal
@close="this.dialogOpen = false" @close="this.dialogOpen = false"
:visible="dialogOpen" :visible="dialogOpen"
:title="community.name" :title="community.name"
:message="community.description" :message="community.description"
> >
</NotificationModal> <div class="flex justify-center p-2">
<ColoredButton
v-if="!member"
:text="'Bli med'"
@click="goToJoin(community.communityId)"
/>
<ColoredButton
v-if="member"
:text="'Gå til'"
@click="goToGroup(community.communityId)"
/>
</div>
</CustomFooterModal>
<div <div
@click="toggleDialog()" @click="toggleDialog()"
class="bg-white shadow dark:bg-gray-800 select-none cursor-pointer hover:bg-gray-50 flex items-center p-4" class="bg-white shadow dark:bg-gray-800 select-none cursor-pointer hover:bg-gray-50 flex items-center p-4"
> >
<div class="h-10 w-10 flex flex-col justify-center items-center mr-4"> <div class="h-10 w-10 flex flex-col justify-center items-center mr-4">
<img alt="Felleskapets bilde" src="@/assets/group.png" /> <UserGroupIcon v-if="!community.image" alt="Felleskapets bilde" />
<!-- TODO: USE COMMUNITY IMAGE <img alt="Felleskapets bilde" src="@/assets/group.png" /> -->
</div> </div>
<div class="flex-1 pl-1 overflow-hidden"> <div class="flex-1 pl-1 overflow-hidden">
<div class="font-medium dark:text-white truncate"> <div class="font-medium dark:text-white truncate">
...@@ -23,38 +36,22 @@ ...@@ -23,38 +36,22 @@
v-if="community.visibility === 0" v-if="community.visibility === 0"
class="max-h-6 max-w-6 shrink m-2" class="max-h-6 max-w-6 shrink m-2"
/> />
<LockOpenIcon
v-if="community.visibility === 1"
class="max-h-6 max-w-6 shrink m-2"
/>
<button
@click="goToJoin(community.communityId)"
v-if="!member"
class="px-4 py-2 w-24 font-medium tracking-wide text-white capitalize transition-colors duration-200 transform bg-blue-600 rounded-md hover:bg-blue-500 focus:outline-none focus:ring focus:ring-blue-300 focus:ring-opacity-80"
>
Bli med
</button>
<button
v-if="member"
@click="goToGroup(community.communityId)"
class="px-4 py-2 w-24 font-medium tracking-wide text-white capitalize transition-colors duration-200 transform bg-blue-600 rounded-md hover:bg-blue-500 focus:outline-none focus:ring focus:ring-blue-300 focus:ring-opacity-80"
>
Gå til
</button>
</div> </div>
</div> </div>
</template> </template>
<script> <script>
import { LockClosedIcon, LockOpenIcon } from "@heroicons/vue/outline"; import CustomFooterModal from "@/components/BaseComponents/CustomFooterModal.vue";
import NotificationModal from "@/components/BaseComponents/NotificationModal.vue"; import ColoredButton from "@/components/BaseComponents/ColoredButton.vue";
import { UserGroupIcon, LockClosedIcon } from "@heroicons/vue/outline";
export default { export default {
name: "CommunityListItem", name: "CommunityListItem",
components: { components: {
NotificationModal, CustomFooterModal,
ColoredButton,
UserGroupIcon,
LockClosedIcon, LockClosedIcon,
LockOpenIcon,
}, },
data() { data() {
return { return {
......
<template> <template>
<GroupHome></GroupHome> <CommunityHome />
</template> </template>
<script> <script>
import GroupHome from "@/components/CommunityComponents/CommunityHome"; import CommunityHome from "@/components/CommunityComponents/CommunityHome.vue";
export default { export default {
name: "GroupHomeView.vue", name: "CommunityHomeView",
components: { components: {
GroupHome, CommunityHome,
}, },
}; };
</script> </script>
<style scoped></style>
<template> <template>
<div> <div v-if="loggedIn">
<img <div class="flex flex-row p-4 relative">
class="cursor-pointer h-8 mr-4 mt-4 float-right" <p class="capitalize font-bold w-full">Mine felleskap</p>
v-if="loggedIn" <PlusIcon
src="@/assets/newCommunity.png" class="cursor-pointer max-h-6 max-w-6 float-right grow"
alt="Legg til gruppe" @click="$router.push('/createNewGroup')"
@click="$router.push('/createNewGroup')" v-if="loggedIn"
/> alt="Lag ett nytt felleskap"
</div> />
<div>
<div id="myGroups" v-if="loggedIn">
<div class="m-4">Mine grupper:</div>
<CommunityList :communities="myCommunities" :member="true" />
</div>
<div id="localGroups">
<div class="m-4">Offentlige grupper:</div>
<CommunityList :communities="publicCommunities" :member="false" />
</div> </div>
<CommunityList :communities="myCommunities" :member="true" />
</div> </div>
<p class="capitalize font-bold w-full p-4">Offentlige felleskap</p>
<CommunityList :communities="publicCommunities" :member="false" />
</template> </template>
<script> <script>
import CommunityList from "@/components/CommunityComponents/CommunityList.vue"; import CommunityList from "@/components/CommunityComponents/CommunityList.vue";
import { getMyGroups, getVisibleGroups } from "@/utils/apiutil"; import { getMyGroups, getVisibleGroups } from "@/utils/apiutil";
import { PlusIcon } from "@heroicons/vue/outline";
export default { export default {
name: "HomeView", name: "HomeView",
...@@ -35,12 +31,16 @@ export default { ...@@ -35,12 +31,16 @@ export default {
}, },
components: { components: {
CommunityList, CommunityList,
PlusIcon,
}, },
async created() { async created() {
this.loggedIn = this.$store.state.user.token !== null;
this.publicCommunities = await getVisibleGroups(); this.publicCommunities = await getVisibleGroups();
this.loggedIn = this.$store.state.user.token !== null;
if (!this.loggedIn) return; if (!this.loggedIn) return;
this.myCommunities = await getMyGroups(); this.myCommunities = await getMyGroups();
// Remove all of the user's communities from the public communities arrays
this.publicCommunities = this.publicCommunities.filter( this.publicCommunities = this.publicCommunities.filter(
(val) => !this.myCommunities.includes(val) (val) => !this.myCommunities.includes(val)
); );
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment