Skip to content

Commit

Permalink
Improvements to the mobile experience with the navbar. Now you are ab…
Browse files Browse the repository at this point in the history
…le to toggle the navbar the same way you are able to do in Desktop. To open the header, a new icon will be in the top left corner. If the position of the icon is troublesome, it will be moved.
  • Loading branch information
ftwpala authored and slugalisk committed Jul 16, 2023
1 parent fdaf2f3 commit 930f33a
Show file tree
Hide file tree
Showing 4 changed files with 43 additions and 11 deletions.
15 changes: 14 additions & 1 deletion src/components/Header.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import { faComments } from '@fortawesome/free-solid-svg-icons';
import '../css/Header';

import type { State } from '../redux/types';
import { toggleChat, showChat, CHAT_HOST_SERVICE, CHAT_HOST_STRIMS, CHAT_HOST_DGG } from '../actions';
import { toggleChat, showChat, showHeader, CHAT_HOST_SERVICE, CHAT_HOST_STRIMS, CHAT_HOST_DGG } from '../actions';
import { supportedChatServices } from '../util/supported-chats';
import isVod from '../util/is-vod';
import HeaderForm from './HeaderForm';
Expand All @@ -31,6 +31,7 @@ type OwnProps = {||};
type Props = {|
...OwnProps,
+chatClosed?: boolean,
+headerClosed?: boolean,
+currentStreamService?: string | null,
+history: BrowserHistory,
classes: string,
Expand All @@ -40,12 +41,14 @@ type Props = {|
+isStrimsChat: boolean,
+rustlerCount: number[] | null,
+showChat: () => {},
+showHeader: () => {},
+showDggChat: boolean,
+toggleChat: (host: mixed) => {}
|};

const Header = ({
chatClosed,
headerClosed,
currentStreamService,
history,
classes,
Expand All @@ -55,6 +58,7 @@ const Header = ({
isStrimsChat,
rustlerCount,
showChat,
showHeader,
showDggChat,
toggleChat
}: Props) => {
Expand Down Expand Up @@ -102,10 +106,17 @@ const Header = ({
</div>
);

let openHeader = !headerClosed ? null : (
<div title="Open Header" className='open-header-mobile-btn' onClick={showHeader}>
<span className='open-header-caret-mobile'>&#8250;</span>
</div>
);

return (
<>
<Navbar expand='lg' variant='dark' className={classes}>
{openChat}
{openHeader}
<Navbar.Brand>
<Link className='navbar-brand' to='/'>Strims</Link>
</Navbar.Brand>
Expand Down Expand Up @@ -187,6 +198,7 @@ function mapStateToProps(state: State): $Shape<Props> {
rustlerCount: state.streams[state.stream] ? [state.streams[state.stream].rustlers, state.streams[state.stream].viewers] : null,
showDggChat: Boolean(idx(state, _ => _.self.profile.data.show_dgg_chat)),
chatClosed: !state.ui.showChat,
headerClosed: !state.ui.showHeader,
};
}

Expand All @@ -196,6 +208,7 @@ export default compose(
{
toggleChat,
showChat,
showHeader,
}
)
)(Header);
1 change: 1 addition & 0 deletions src/components/RoutesWithChat.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@ export default compose(
chatSize: state.ui.chatSize,
showLeftChat: idx(state, _ => _.self.profile.data.left_chat),
chatClosed: !state.ui.showChat || !state.self.isLoggedIn,
headerClosed: !state.ui.showHeader,
}),
{
setChatSize,
Expand Down
15 changes: 10 additions & 5 deletions src/css/Header.scss
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,19 @@
border-radius: 0px;
}

.open-chat-btn{
.open-chat-btn,.open-header-mobile-btn{
position: fixed;
right: 25px;
top: 65px;
z-index: 1;
cursor: pointer;
}

.close-header .open-chat-btn{
.open-header-mobile-btn{
left: 25px;
}

.close-header .open-chat-btn,.close-header .open-header-mobile-btn{
top: 10px;
}

Expand Down Expand Up @@ -59,6 +63,9 @@
min-height: unset;
overflow:visible;
}
.close-header.navbar{
overflow:hidden;
}
@media (orientation:landscape){
.nav-item {
padding-left: 0.5rem;
Expand All @@ -71,7 +78,5 @@
padding-right: 0.5rem;
}
}
#open-chat-btn{
display: none;
}

}
23 changes: 18 additions & 5 deletions src/css/Stream.scss
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,6 @@
}


@include media-breakpoint-down(md) {
.open-header-btn,.close-header-btn{
display: none;
}
}

.open-header-caret,.close-header-caret{
position: fixed;
Expand All @@ -42,6 +37,16 @@
opacity:1;
}

.open-header-caret-mobile{
display: none;
position:fixed;
rotate: 90deg;
color: #D17134;
font-size: 32px;
line-height: 20px;
opacity: 0.4;
}

.open-header-caret{
top: -15px;
rotate: 90deg;
Expand All @@ -58,6 +63,14 @@
}

@include media-breakpoint-down(md) {
.open-header-caret-mobile{
display: block;
}

.close-header-caret{
top:35px;
}

@media (orientation:portrait){
.chat-embed {
height: 100%;
Expand Down

0 comments on commit 930f33a

Please sign in to comment.