added material design and rank names to social container

master
Max 5 years ago
parent d135cc74ba
commit 78932fb17c

@ -1,8 +1,9 @@
<div id='chatlist'> <div id='chatlist'>
<div id="header"> <!--<div id="header">
<span class="title">Chats</span> <span class="title">Chats</span>
<button id="newchat" (click)="newChat()"><span><i class="fa fa-plus fa-3x" aria-hidden="true"></i></span></button> <button id="newchat" (click)="newChat()"><span><i class="fa fa-plus fa-3x" aria-hidden="true"></i></span></button>
</div> </div>-->
<mat-toolbar><span>Chat</span></mat-toolbar>
<div id="chats"> <div id="chats">
<div class="chatitem" *ngFor="let chat of childChats" <div class="chatitem" *ngFor="let chat of childChats"
[class.selected]="chat === selectedChat" (click)="showChat(chat)"> [class.selected]="chat === selectedChat" (click)="showChat(chat)">

@ -6,7 +6,6 @@
width: 100% width: 100%
margin-top: 0.5em margin-top: 0.5em
::ng-deep .mat-card-header-text ::ng-deep .mat-card-header-text
margin: 0px margin: 0px

@ -1,7 +1,7 @@
<div id="content" fxShow="true" fxHide.lt-md="true"> <div id="content" fxShow="true" fxHide.lt-md="true">
<home-chatmanager id="chatcontainer" *ngIf="loggedIn"></home-chatmanager> <div id="chat"><home-chatmanager id="chatcontainer" *ngIf="!loggedIn"></home-chatmanager></div>
<home-feed id="feedcontainer"></home-feed> <div id="feed"><home-feed id="feedcontainer"></home-feed></div>
<home-social id="socialcontainer" *ngIf="loggedIn"></home-social> <div id="social"><home-social id="socialcontainer" *ngIf="!loggedIn"></home-social></div>
</div> </div>
<!-- <!--
<mat-tab-group headerPosition="below" position="0" id="bottom-menu" fxShow="true" fxHide.gt-sm="true"> <mat-tab-group headerPosition="below" position="0" id="bottom-menu" fxShow="true" fxHide.gt-sm="true">

@ -2,28 +2,30 @@
@import '../../../styles/vars.sass' @import '../../../styles/vars.sass'
#content #content
grid-template: 100%/ 25% 50% 25% position: fixed
display: grid width: 100%
min-height: 90vh height: calc(100% - 56px)
max-height: 90vh
#chat
#chatcontainer box-sizing: content-box
@include gridPosition(1, 3, 1, 2) height: 100%
background-color: $cBoxBodyBackground width: 25%
overflow: auto float: left
overflow-y: auto
#feedcontainer
@include gridPosition(1, 3, 2, 3) #feed
display: grid box-sizing: content-box
grid-template: 10% 90% /100% height: 100%
overflow: auto width: 50%
float: left
#socialcontainer overflow-y: auto
@include gridPosition(1, 3, 3, 4)
display: grid #social
grid-template: 50% 50% /100% box-sizing: content-box
background-color: $cBoxBodyBackground height: 100%
overflow: auto width: 25%
float: left
overflow-y: auto
.mat-toolbar.mat-primary .mat-toolbar.mat-primary
width: 100% width: 100%
@ -36,7 +38,6 @@
.bottom-menu .bottom-menu
position: fixed position: fixed
width: 100% width: 100%
height: calc(100% - 56px) height: calc(100% - 56px)

@ -1,12 +1,22 @@
<div id="header"> <!--<div id="header">
<span class="title">Friends</span> <span class="title">Friends</span>
<button id="new" type="submit"><span><i class="fa fa-plus fa-3x" aria-hidden="true"></i></span></button> <button id="new" type="submit"><span><i class="fa fa-plus fa-3x" aria-hidden="true"></i></span></button>
<button id="invitations" type="submit"><span><i class="fa fa-envelope-o fa-3x" aria-hidden="true"></i></span></button> <button id="invitations" type="submit"><span><i class="fa fa-envelope-o fa-3x" aria-hidden="true"></i></span></button>
</div> </div>-->
<div id="friendslist"> <mat-toolbar><span>Friends</span></mat-toolbar>
<div class="frienditem" *ngFor="let friend of friends" <div id="friendlist">
<!--<div class="frienditem" *ngFor="let friend of friends"
[class.selected]="friend === selectedFriend" (click)="showFriendProfile(friend)"> [class.selected]="friend === selectedFriend" (click)="showFriendProfile(friend)">
<div class="picture">Pic</div> <div class="picture">Pic</div>
<div class="name"><span>{{friend.name}}</span></div> <div class="name"><span>{{friend.name}}</span></div>
</div> </div>-->
<mat-card class="friend-card" *ngFor="let friend of friends"
[class.selected]="friend === selectedFriend" (click)="showFriendProfile(friend)"
tabindex="0">
<mat-card-header>
<div mat-card-avatar class="profile-picture"></div>
<mat-card-title>{{friend.name}}</mat-card-title>
<mat-card-subtitle>{{friend.rankname}}</mat-card-subtitle>
</mat-card-header>
</mat-card>
</div> </div>

@ -2,31 +2,18 @@
@import '../../../../styles/vars.sass' @import '../../../../styles/vars.sass'
@import '../social.component.sass' @import '../social.component.sass'
#friendslist #friendlist
overflow: auto padding: 0.5em
@include gridPosition(2, 3, 1, 2)
div:hover .friend-card
background-color: darken($cPrimaryBackground, 10%) box-sizing: border-box
width: 100%
margin-top: 0.5em
cursor: pointer cursor: pointer
.frienditem
background-color: $cPrimaryBackground .mat-card-subtitle
height: 3em margin: 0
margin: 0.2em
padding: 0.25em .profile-picture
border-radius: 0.25em background-image: url(https://material.angular.io/assets/img/examples/shiba1.jpg)
//border: solid background-size: cover
display: grid
grid-template: 100% / 20% 60% 20%
.picture
@include gridPosition(1, 2, 1, 2)
border: solid
.name, .date
margin-top: auto
margin-bottom: auto
.name
@include gridPosition(1, 2, 2, 3)
font-weight: bold
text-align: left
padding-left: 0.5em
span
font-size: 125%

@ -35,13 +35,14 @@ export class FriendsComponent implements OnInit {
} }
readOutFriendsNames(pId: number, pResponse : any) { readOutFriendsNames(pId: number, pResponse : any) {
this.friends.push(new FriendInfo(pId, pResponse.data.getUser.name)) this.friends.push(new FriendInfo(pId, pResponse.data.getUser.name,pResponse.data.getUser.level ))
} }
buildJson(pId: number): any { buildJson(pId: number): any {
const body = {query: `query($userId: ID) { const body = {query: `query($userId: ID) {
getUser(userId:$userId) { getUser(userId:$userId) {
name name
level
} }
}`, variables: { }`, variables: {
userId: pId userId: pId

@ -1,12 +1,20 @@
<div id="header"> <!--<div id="header">
<span class="title">Groups</span> <span class="title">Groups</span>
<button id="new" type="submit"><span><i class="fa fa-plus fa-3x" aria-hidden="true"></i></span></button> <button id="new" type="submit"><span><i class="fa fa-plus fa-3x" aria-hidden="true"></i></span></button>
<button id="invitations" type="submit"><span><i class="fa fa-envelope-o fa-3x" aria-hidden="true"></i></span></button> <button id="invitations" type="submit"><span><i class="fa fa-envelope-o fa-3x" aria-hidden="true"></i></span></button>
</div> </div>-->
<div id="groupslist"> <mat-toolbar><span>Groups</span></mat-toolbar>
<div class="groupitem" *ngFor="let group of groups" <div id="grouplist">
<!--<div class="groupitem" *ngFor="let group of groups"
[class.selected]="group === selectedGroup" (click)="showGroup(group)"> [class.selected]="group === selectedGroup" (click)="showGroup(group)">
<div class="picture">Pic</div> <div class="picture">Pic</div>
<div class="name"><span>{{group.name}}</span></div> <div class="name"><span>{{group.name}}</span></div>
</div> </div>-->
<mat-card class="group-card" *ngFor="let group of groups"
[class.selected]="group === selectedGroup" (click)="showGroup(group)">
<mat-card-header>
<div mat-card-avatar class="group-picture"></div>
<mat-card-title>{{group.name}}</mat-card-title>
</mat-card-header>
</mat-card>
</div> </div>

@ -2,31 +2,16 @@
@import '../../../../styles/vars.sass' @import '../../../../styles/vars.sass'
@import '../social.component.sass' @import '../social.component.sass'
#groupslist #grouplist
overflow: auto padding: 0.5em
@include gridPosition(2, 3, 1, 2)
div:hover .group-card
background-color: darken($cPrimaryBackground, 10%) box-sizing: border-box
cursor: pointer width: 100%
.groupitem margin-top: 0.5em
background-color: $cPrimaryBackground .mat-card-subtitle
height: 3em margin: 0
margin: 0.2em
padding: 0.25em .group-picture
border-radius: 0.25em background-image: url(https://material.angular.io/assets/img/examples/shiba1.jpg)
//border: solid background-size: cover
display: grid
grid-template: 100% / 20% 60% 20%
.picture
@include gridPosition(1, 2, 1, 2)
border: solid
.name, .date
margin-top: auto
margin-bottom: auto
.name
@include gridPosition(1, 2, 2, 3)
font-weight: bold
text-align: left
padding-left: 0.5em
span
font-size: 125%

@ -2,43 +2,13 @@
@import '../../../styles/vars.sass' @import '../../../styles/vars.sass'
#friendscontainer #friendscontainer
@include gridPosition(1, 2, 1, 2) box-sizing: content-box
display: grid height: 50%
grid-template: 15% 85% /100% width: 100%
overflow: auto
#groupscontainer #groupscontainer
@include gridPosition(2, 3, 1, 2) box-sizing: content-box
display: grid height: 50%
grid-template: 15% 85% /100% width: 100%
overflow: auto
#header
@include gridPosition(1, 2, 1, 2)
background-color: $cBoxHeaderBackground
display: grid
grid-template: 100% /60% 20% 20%
span
color: $cFontWhite
span.title
@include gridPosition(1, 2, 1, 2)
margin-top: 0.25em
margin-left: 0.25em
line-height: 100%
font-size: 2em
button
background-color: $cBoxHeaderBackground
border: none
button:hover
background-color: lighten($cBoxHeaderBackground, 10%)
cursor: pointer
button:active
background-color: darken($cBoxHeaderBackground, 5%)
#new
@include gridPosition(1, 2, 2, 3)
#invitations
@include gridPosition(1, 2, 3, 4)

@ -1,9 +1,14 @@
import { Levellist } from 'src/app/models/levellist';
export class FriendInfo { export class FriendInfo {
levellist: Levellist = new Levellist();
id: number id: number
name: string name: string
rankname: string
constructor(pId: number, pName: string) { constructor(pId: number, pName: string, pLevel: number) {
this.id = pId this.id = pId
this.name = pName this.name = pName
this.rankname = this.levellist.getLevelName(pLevel);
} }
} }

@ -11,11 +11,8 @@ export class Levellist{
getLevelName(lev:number): any{ getLevelName(lev:number): any{
var name: string = 'not defined'; var name: string = 'not defined';
console.log(lev);
this.levels.forEach(rank => { this.levels.forEach(rank => {
console.log(rank.level);
if(lev == rank.level){ if(lev == rank.level){
console.log('found matching level');
name = rank.name; name = rank.name;
} }
}); });

@ -105,13 +105,15 @@ export class ChatService {
for(let chat of temp.data.getSelf.chats) { for(let chat of temp.data.getSelf.chats) {
let memberID: number let memberID: number
let memberName: string let memberName: string
let memberLevel: number
for(let member of chat.members) { for(let member of chat.members) {
if(member.id != this.ownID) { if(member.id != this.ownID) {
memberID = member.id memberID = member.id
memberName = member.name memberName = member.name
memberLevel = member.level
} }
} }
chatPartners.push(new FriendInfo(memberID, memberName)) chatPartners.push(new FriendInfo(memberID, memberName, memberLevel))
} }
return chatPartners return chatPartners
@ -221,7 +223,7 @@ export class ChatService {
getBodyForRequestOfAllChatPartners() { getBodyForRequestOfAllChatPartners() {
const body = {query: `query { const body = {query: `query {
getSelf { getSelf {
chats(first: 1000, offset: 0) {members{name, id}} chats(first: 1000, offset: 0) {members{name, id, level}}
}}` }}`
} }
@ -243,7 +245,7 @@ export class ChatService {
const body = {query: `query { const body = {query: `query {
getSelf { getSelf {
chats(first: 1000, offset: 0) { chats(first: 1000, offset: 0) {
id, members{name, id}, id, members{name, id, level},
messages(first: 1000, offset: 0) { messages(first: 1000, offset: 0) {
author {id}, createdAt, content author {id}, createdAt, content
} }
@ -256,7 +258,7 @@ export class ChatService {
getBodyForGetChatsByID(pChatID: number) { getBodyForGetChatsByID(pChatID: number) {
const body = {query: `query($chatID: ID!) { const body = {query: `query($chatID: ID!) {
getChat(chatId: $chatID) {id, members{name, id}, getChat(chatId: $chatID) {id, members{name, id, level},
messages(first: 1000, offset: 0) {author {id}, createdAt, content}} messages(first: 1000, offset: 0) {author {id}, createdAt, content}}
} }
}`, variables: { }`, variables: {

Loading…
Cancel
Save