minor visual improvements - add gradient banner back, polish some elements, combine some classes
This commit is contained in:
parent
e6f78f8ec9
commit
850187e913
14 changed files with 58 additions and 48 deletions
|
@ -46,7 +46,7 @@ globalGatewayConnection.onclose = function() {
|
||||||
warn("Gateway connection closed");
|
warn("Gateway connection closed");
|
||||||
store.dispatch({ type: 'authenticator/updatelocaluserobject', user: undefined });
|
store.dispatch({ type: 'authenticator/updatelocaluserobject', user: undefined });
|
||||||
store.dispatch({ type: 'gateway/connectionstatus', gateway: { isConnected: false } });
|
store.dispatch({ type: 'gateway/connectionstatus', gateway: { isConnected: false } });
|
||||||
store.dispatch({ type: 'application/updatebannertext', text: "⚡ Hang tight! You've lost connection!" });
|
store.dispatch({ type: 'application/updatebannertext', text: "Hang tight! You've lost connection!" });
|
||||||
const interval = setInterval(() => {
|
const interval = setInterval(() => {
|
||||||
if (globalGatewayConnection.ws.readyState === 1) {
|
if (globalGatewayConnection.ws.readyState === 1) {
|
||||||
clearInterval(interval);
|
clearInterval(interval);
|
||||||
|
|
|
@ -2,28 +2,20 @@ import Message from "../Messages/Message";
|
||||||
import { useRef, useEffect } from 'react';
|
import { useRef, useEffect } from 'react';
|
||||||
|
|
||||||
export default function ChannelMessageView({messages}) {
|
export default function ChannelMessageView({messages}) {
|
||||||
const invisibleBottomMessageRef = useRef(null);
|
const invisibleBottomMessageRef = useRef();
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (invisibleBottomMessageRef && invisibleBottomMessageRef.current) {
|
invisibleBottomMessageRef.current.scrollIntoView(true);
|
||||||
invisibleBottomMessageRef.current.scrollIntoView({ behaviour: 'smooth' });
|
|
||||||
}
|
|
||||||
}, [messages]);
|
}, [messages]);
|
||||||
|
|
||||||
let messagesView = messages.map((m, i) => {
|
let messagesView = messages.map((message) => (<Message key={message._id} message={message} />));
|
||||||
return <Message key={ m._id } message={ m } />;
|
if (messagesView === undefined || messagesView.length <= 0)
|
||||||
});
|
messagesView = (<div className='no-messages-warning'>
|
||||||
|
<span>No messages yet...</span>
|
||||||
if (messagesView === undefined || messagesView.length <= 0) {
|
</div>);
|
||||||
messagesView = (
|
|
||||||
<div className='no-messages-warning'>
|
|
||||||
<span>No messages yet...</span>
|
|
||||||
</div>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
return <div className="message-list-card">
|
return <div className="message-list-card">
|
||||||
{ messagesView }
|
{ messagesView }
|
||||||
<div ref={ invisibleBottomMessageRef }></div>
|
<div className="messages-scroll-div" ref={ invisibleBottomMessageRef }></div>
|
||||||
</div>;
|
</div>;
|
||||||
}
|
}
|
|
@ -28,7 +28,7 @@ const ChannelView = ({ messages, channel, channelPresenceClientList }) => {
|
||||||
if (channel) {
|
if (channel) {
|
||||||
return (
|
return (
|
||||||
<div className="col-flex-card hidden-overflow">
|
<div className="col-flex-card hidden-overflow">
|
||||||
<div className="bar-card-accent">
|
<div className="bar-card-accent no-select">
|
||||||
<ChannelProfile channel={ channel } size="24" />
|
<ChannelProfile channel={ channel } size="24" />
|
||||||
{/*
|
{/*
|
||||||
{ (experiments.voiceSFUTesting) && <button className="button" onClick={ () => gatewayConnection.beginVoiceSession(channel._id) }>
|
{ (experiments.voiceSFUTesting) && <button className="button" onClick={ () => gatewayConnection.beginVoiceSession(channel._id) }>
|
||||||
|
@ -38,9 +38,9 @@ const ChannelView = ({ messages, channel, channelPresenceClientList }) => {
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div className="row-flex-card hidden-overflow">
|
<div className="row-flex-card hidden-overflow">
|
||||||
<div className="col-flex-card channel-message-panel hidden-overflow">
|
<div className="channel-message-panel">
|
||||||
<ChannelMessageView messages={messages}></ChannelMessageView>
|
<ChannelMessageView messages={messages}></ChannelMessageView>
|
||||||
<div className="invis-bar">
|
<div className="col-flex-card">
|
||||||
<input className="text-input message-input" type="text" placeholder="Go on, type something interesting!" ref={ textInputRef } onKeyDown={ handleTextboxKeydown } onChange={ ({ target }) => setTextInput(target.value) }></input>
|
<input className="text-input message-input" type="text" placeholder="Go on, type something interesting!" ref={ textInputRef } onKeyDown={ handleTextboxKeydown } onChange={ ({ target }) => setTextInput(target.value) }></input>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -4,7 +4,6 @@ import Root from '../Home/Root';
|
||||||
import Authenticator from '../../API/Authenticator';
|
import Authenticator from '../../API/Authenticator';
|
||||||
import Notification from '../UI/Notification';
|
import Notification from '../UI/Notification';
|
||||||
import './../../Styles/App.scss';
|
import './../../Styles/App.scss';
|
||||||
import Sidebar from '../UI/Sidebar';
|
|
||||||
|
|
||||||
import { useEffect, useState } from 'react';
|
import { useEffect, useState } from 'react';
|
||||||
import { useDispatch, connect } from 'react-redux'
|
import { useDispatch, connect } from 'react-redux'
|
||||||
|
@ -41,7 +40,7 @@ function App({ user }) {
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<Route path="/">
|
<Route path="/">
|
||||||
{ user && <Sidebar /> }
|
{ user && <LoggedInMount /> }
|
||||||
<Root user={user} />
|
<Root user={user} />
|
||||||
</Route>
|
</Route>
|
||||||
</Switch>
|
</Switch>
|
||||||
|
|
|
@ -1,11 +1,20 @@
|
||||||
import { useParams } from "react-router-dom";
|
import { useParams } from "react-router-dom";
|
||||||
import Sidebar from "../UI/Sidebar";
|
import Sidebar from "../UI/Sidebar";
|
||||||
import ChannelView from "../Channels/ChannelView";
|
import ChannelView from "../Channels/ChannelView";
|
||||||
|
import GradientBanner from "../UI/GradientBanner";
|
||||||
|
import { connect } from "react-redux";
|
||||||
|
|
||||||
export default function LoggedInMount() {
|
function LoggedInMount({ gradientBannerNotificationText }) {
|
||||||
const { id: channelId } = useParams();
|
const { id: channelId } = useParams();
|
||||||
return <>
|
return <>
|
||||||
<Sidebar />
|
<Sidebar />
|
||||||
<ChannelView channelId={ channelId } />
|
<div className="col-flex-card">
|
||||||
|
<GradientBanner text={ gradientBannerNotificationText }/>
|
||||||
|
{ (channelId) && <ChannelView channelId={ channelId } /> }
|
||||||
|
</div>
|
||||||
</>;
|
</>;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export default connect((state) => ({
|
||||||
|
gradientBannerNotificationText: state.gradientBannerNotificationText
|
||||||
|
}))(LoggedInMount);
|
|
@ -1,5 +1,9 @@
|
||||||
export default function GradientBanner() {
|
import { useDispatch } from "react-redux";
|
||||||
return (gradientBannerNotificationText !== undefined) && <div className="gradient-banner-card" onClick={ () => dispatch({ type: "application/updatebannertext", text: undefined }) }>
|
|
||||||
{ gradientBannerNotificationText }
|
export default function GradientBanner({ text }) {
|
||||||
|
const dispatch = useDispatch();
|
||||||
|
|
||||||
|
return (text !== undefined) && <div className="gradient-banner-card" onClick={ () => dispatch({ type: "application/updatebannertext", text: undefined }) }>
|
||||||
|
{ text }
|
||||||
</div>;
|
</div>;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
// This is a mess pls fix later
|
// TODO: This is an actual, horrible mess
|
||||||
export default function ProfileLink({ object, size, type, offset=true, children=null, hideName=false }) {
|
export default function ProfileLink({ object, size, type, offset=true, children=null, hideName=false }) {
|
||||||
let picture;
|
let picture;
|
||||||
|
|
||||||
|
|
|
@ -8,6 +8,7 @@
|
||||||
@import "./Components/ProfileLink.scss";
|
@import "./Components/ProfileLink.scss";
|
||||||
@import "./Components/Message.scss";
|
@import "./Components/Message.scss";
|
||||||
@import "./Components/Textbox.scss";
|
@import "./Components/Textbox.scss";
|
||||||
|
@import "./Components/properties.scss";
|
||||||
|
|
||||||
::-webkit-scrollbar {
|
::-webkit-scrollbar {
|
||||||
width: 0px;
|
width: 0px;
|
||||||
|
@ -29,11 +30,7 @@ body {
|
||||||
padding: 0px;
|
padding: 0px;
|
||||||
}
|
}
|
||||||
|
|
||||||
button,
|
button, input, optgroup, select, textarea {
|
||||||
input,
|
|
||||||
optgroup,
|
|
||||||
select,
|
|
||||||
textarea {
|
|
||||||
font-family: inherit;
|
font-family: inherit;
|
||||||
font-size: 100%;
|
font-size: 100%;
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,10 +11,10 @@
|
||||||
|
|
||||||
.bar-card {
|
.bar-card {
|
||||||
@include card;
|
@include card;
|
||||||
|
@extend .elevated;
|
||||||
|
|
||||||
height: 32px;
|
height: 32px;
|
||||||
padding: 12px;
|
padding: 12px;
|
||||||
box-shadow: var(--bar-card-box-shadow);
|
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
justify-content: left;
|
justify-content: left;
|
||||||
|
|
|
@ -11,9 +11,9 @@
|
||||||
.sidebar {
|
.sidebar {
|
||||||
@include fancy-scrollbar-firefox;
|
@include fancy-scrollbar-firefox;
|
||||||
@include card;
|
@include card;
|
||||||
|
@extend .no-select;
|
||||||
|
|
||||||
background-color: var(--sidebar-background-color);
|
background-color: var(--sidebar-background-color);
|
||||||
|
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
overflow: auto;
|
overflow: auto;
|
||||||
|
@ -30,17 +30,10 @@
|
||||||
margin: 5px;
|
margin: 5px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.invis-bar {
|
|
||||||
display: flex;
|
|
||||||
flex-direction: column;
|
|
||||||
padding: 10px;
|
|
||||||
|
|
||||||
z-index: 100;
|
|
||||||
}
|
|
||||||
|
|
||||||
.channel-message-panel {
|
.channel-message-panel {
|
||||||
display: flex;
|
@extend .hidden-overflow;
|
||||||
flex-direction: column;
|
@extend .col-flex-card;
|
||||||
|
|
||||||
padding: 15px;
|
padding: 15px;
|
||||||
background-color: var(--channel-view-container-color);
|
background-color: var(--channel-view-container-color);
|
||||||
}
|
}
|
||||||
|
@ -52,3 +45,12 @@
|
||||||
.hidden {
|
.hidden {
|
||||||
visibility: hidden;
|
visibility: hidden;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.no-select {
|
||||||
|
user-select: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.messages-scroll-div {
|
||||||
|
height: 18px;
|
||||||
|
visibility: hidden;
|
||||||
|
}
|
|
@ -10,6 +10,8 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
.no-messages-warning {
|
.no-messages-warning {
|
||||||
|
@extend .no-select;
|
||||||
|
|
||||||
display: flex;
|
display: flex;
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
|
|
|
@ -11,7 +11,9 @@
|
||||||
border-radius: var(--message-box-border-radius);
|
border-radius: var(--message-box-border-radius);
|
||||||
background-color: var(--message-box-color);
|
background-color: var(--message-box-color);
|
||||||
height: 32px;
|
height: 32px;
|
||||||
padding: 6px;
|
padding: 8px;
|
||||||
|
margin: 0;
|
||||||
|
margin-bottom: 5px;
|
||||||
padding-left: 16px;
|
padding-left: 16px;
|
||||||
font-size: 16px;
|
font-size: 16px;
|
||||||
}
|
}
|
||||||
|
|
3
bfrontend/src/Styles/Components/properties.scss
Normal file
3
bfrontend/src/Styles/Components/properties.scss
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
.elevated {
|
||||||
|
box-shadow: var(--elevation-box-shadow);
|
||||||
|
}
|
|
@ -25,7 +25,7 @@
|
||||||
|
|
||||||
--channel-top-bar-color-accent: var(--background-color);
|
--channel-top-bar-color-accent: var(--background-color);
|
||||||
--channel-top-bar-color: var(--background-color);
|
--channel-top-bar-color: var(--background-color);
|
||||||
--bar-card-box-shadow: 0 1px 0 0 hsla(230, 12%, 5%, 0.3), 0 2px 0 0 hsla(230, 12%, 6%, 0.2), 0 3px 0 0 hsla(230, 12%, 7%, 0.1);
|
--elevation-box-shadow: 0 1px 0 0 hsla(230, 12%, 5%, 0.3), 0 2px 0 0 hsla(230, 12%, 6%, 0.2), 0 3px 0 0 hsla(230, 12%, 7%, 0.1);
|
||||||
--message-box-color: var(--card-accent-color);
|
--message-box-color: var(--card-accent-color);
|
||||||
|
|
||||||
--sidebar-background-color: hsl(230, 12%, 12%);
|
--sidebar-background-color: hsl(230, 12%, 12%);
|
||||||
|
|
Loading…
Reference in a new issue