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

ISSUE-30: Main Layout #31

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open
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
1 change: 1 addition & 0 deletions client/public/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
<link rel="icon" href="<%= BASE_URL %>favicon.ico">
<title>entropychat.app</title>
<link href="https://fonts.googleapis.com/css2?family=Manrope:wght@200;300;400;500;600;700&display=swap" rel="stylesheet">
<script src="https://cdn.jsdelivr.net/npm/feather-icons/dist/feather.min.js"></script>
</head>
<body>
<noscript>
Expand Down
Binary file added client/src/assets/logo-black.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added client/src/assets/logo-white.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified client/src/assets/logo.png
100644 → 100755
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
117 changes: 117 additions & 0 deletions client/src/components/community/Channel.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,117 @@
<template>
<div class="channel" :class="selected && 'channel--active'">
<i class="channel__icon" data-feather="hash"></i>
<span class="channel__name">{{name}}</span>
<div class="channel__actions" v-if="true">
<i class="channel__actions__add" data-feather="user-plus"></i>
<i class="channel__actions__settings" data-feather="settings"></i>
</div>
</div>
</template>

<script>
import { onMounted } from '@vue/composition-api';

export default {
props: {
name: {
type: String,
required: true,
},
selected: {
type: Boolean,
default: false,
},
},
setup() {
onMounted(() => {
// eslint-disable-next-line no-undef
feather.replace();
});
},
};
</script>

<style lang="scss">
.channel {
display: flex;
align-items: center;
justify-content: flex-start;

padding: 3px 3px;

border-radius: 5px;

background-color: transparent;
transition: background-color 0.3s;

cursor: pointer;

&__icon {
width: 18px;
height: 18px;

color: $symbol;
}

&__name {
font-size: 13px;

margin-left: 5px;

color: $septenary;
}

&__actions {
visibility: hidden;
margin-left: auto;

&__add {
width: 16px;
height: 16px;

color: $symbol;

cursor: pointer;

transition: color 0.3s;

&:hover {
color: $white;
}
}

&__settings {
width: 16px;
height: 16px;

margin-left: 4px;

color: $symbol;

cursor: pointer;

transition: color 0.3s;

&:hover {
color: $white;
}
}
}

&:hover & {
background-color: $senary;

&__name {
font-weight: bold;
color: $white;
}

&__actions {
visibility: visible;
}
}


}
</style>
109 changes: 109 additions & 0 deletions client/src/components/community/ChannelMessage.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,109 @@
<template>
<div class="channel-message">
<div class="channel-message__avatar" :class="isBot && 'bot'">
<img :src="message.user.image"/>
</div>
<div class="channel-message__body">
<div class="channel-message__body__header">
<strong>{{message.user.name}}</strong>
<span v-if="isBot">Bot</span>
<time>{{new Date(message.createdAt).toLocaleString()}}</time>
</div>
<div class="channel-message__body__text">{{message.text}}</div>
</div>
</div>
</template>

<script>
export default {
props: {
message: {
type: Object,
required: true
},
isBot: {
type: Boolean,
default: false,
},
},
};
</script>

<style lang="scss">
.channel-message {
display: flex;
align-items: center;

padding: 8px 16px;
margin-right: 4px;

background-color: transparent;

&__avatar {
width: 40px;
height: 40px;

background-color: $tertiary;
border-radius: 50%;

img {
width: 40px;
height: 40px;

border-radius: 50%;
}

&.bot {
background-color: $mention-detail;
}
}

&__body {
display: flex;
flex-direction: column;
justify-content: space-between;

min-height: 40px;
margin-left: 17px;

&__header {
display: flex;
align-items: center;

strong {
font-size: 14px;

color: $white;
}

span {
padding: 4px 5px;
margin-left: 6px;

border-radius: 4px;

text-transform: uppercase;
font-weight: bold;
font-size: 11px;

background-color: $discord;
color: $white;
}

time {
margin-left: 6px;
font-size: 11px;

color: $gray;
}
}

&__text {
text-align: left;
font-size: 14px;

color: $white;
}
}
}
</style>
150 changes: 150 additions & 0 deletions client/src/components/community/ChannelMessages.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,150 @@
<template>
<div class="channel-messages">
<div class="channel-messages__container">
<ChannelMessage v-for="message in messages" :key="message._id"
:message="message" />
</div>

<div class="channel-messages__input-wrapper">
<form @submit.prevent="sendMessage()">
<input v-model="message" type="text" placeholder="Message #👋welcome"/>
<i class="channel-messages__input-wrapper__add" data-feather="plus-circle"></i>
</form>
</div>
</div>
</template>

<script>
import ChannelMessage from '@/components/community/ChannelMessage.vue';
import { ref, watch } from '@vue/composition-api';
import { onMounted } from '@vue/composition-api';
import { useState, useActions, useRouter } from '@u3u/vue-hooks';

export default {
components: {
ChannelMessage,
},
setup() {
onMounted(() => {
// eslint-disable-next-line no-undef
feather.replace();
});

const { router } = useRouter();

const message = ref('');

const { user } = useState('auth', [
'user',
]);

const { loading, messages } = useState('messages', [
'messages',
'loading',
]);

const { createMessage } = useActions('messages', [
'createMessage',
]);

const { logout } = useActions('auth', [
'logout',
]);

const { listen } = useActions('messages', [
'listen',
]);

const sendMessage = () => {
createMessage({
text: message.value,
});
message.value = '';
};

watch(user, () => {
if (!user.value) {
router.push('/');
}
});

listen();

return {
user,
logout,
loading,
messages,
sendMessage,
message,
};
},
};
</script>

<style lang="scss">
.channel-messages {
grid-area: CCM;

display: flex;
flex-direction: column;
justify-content: space-between;

background-color: $secondary;

&__container {
display: flex;
flex-direction: column;

max-height: calc(100vh - 46px - 69px);
overflow-y: scroll;

padding: 20px 0;

&::-webkit-scrollbar {
width: 6px;
}

&::-webkit-scrollbar-thumb {
background-color: $quaternary;
border-radius: 6px;
}

&::-webkit-scrollbar-track {
background-color: $tertiary;
}
}

&__input-wrapper {
width: 100%;
padding: 0 16px;

input {
width: 100%;
height: 40px;

padding: 0 10px 0 47px;

border-radius: 7px;

color: $white;
background-color: $primary;

position: relative;

opacity: 0.9;

&::placeholder {
color: $white;
}

~ svg {
position: relative;
top: -32px;
left: 10px;
transition: 180ms ease-in-out;
}
}
}
}
</style>
Loading