style(AdminListModal): differentiate mod and admin role

This commit is contained in:
plebeius.eth
2023-09-26 14:46:11 +02:00
parent 40a2ff94ea
commit 7bd3768e1b
10 changed files with 3381 additions and 3368 deletions
+25 -25
View File
@@ -3,23 +3,15 @@ import Modal from 'react-modal';
import Draggable from 'react-draggable'; import Draggable from 'react-draggable';
import { StyledModal } from '../styled/modals/ReplyModal.styled'; import { StyledModal } from '../styled/modals/ReplyModal.styled';
import useGeneralStore from '../../hooks/stores/useGeneralStore'; import useGeneralStore from '../../hooks/stores/useGeneralStore';
import { BoardForm } from '../styled/views/Board.styled' import { BoardForm } from '../styled/views/Board.styled';
import { Link } from 'react-router-dom'; import { Link } from 'react-router-dom';
const AdminListModal = ({ isOpen, closeModal, roles }) => { const AdminListModal = ({ isOpen, closeModal, roles }) => {
const { const { selectedStyle } = useGeneralStore((state) => state);
selectedAddress,
selectedStyle,
selectedTitle,
} = useGeneralStore(state => state);
const [isMobile, setIsMobile] = useState(window.innerWidth <= 480); const [isMobile, setIsMobile] = useState(window.innerWidth <= 480);
const nodeRef = useRef(null); const nodeRef = useRef(null);
const rolesList = roles const rolesList = roles ? Object.entries(roles).map(([address, { role }]) => ({ address, role })) : [];
? Object.entries(roles).map(([address, { role }]) => ({ address, role }))
: [];
useEffect(() => { useEffect(() => {
const handleResize = () => setIsMobile(window.innerWidth <= 480); const handleResize = () => setIsMobile(window.innerWidth <= 480);
@@ -31,30 +23,33 @@ const AdminListModal = ({ isOpen, closeModal, roles }) => {
}; };
}, [setIsMobile]); }, [setIsMobile]);
return ( return (
<StyledModal <StyledModal
isOpen={isOpen} isOpen={isOpen}
onRequestClose={closeModal} onRequestClose={closeModal}
contentLabel="Reply Modal" contentLabel='Reply Modal'
shouldCloseOnEsc={true} shouldCloseOnEsc={true}
shouldCloseOnOverlayClick={isMobile} shouldCloseOnOverlayClick={isMobile}
selectedStyle={selectedStyle} selectedStyle={selectedStyle}
overlayClassName="overlay" overlayClassName='overlay'
style={isMobile ? ({ overlay: { backgroundColor: "rgba(0,0,0,.25)" }}) : ({ overlay: { backgroundColor: "rgba(0,0,0,0)" }}) style={isMobile ? { overlay: { backgroundColor: 'rgba(0,0,0,.25)' } } : { overlay: { backgroundColor: 'rgba(0,0,0,0)' } }}
}
> >
<Draggable handle=".modal-header" nodeRef={nodeRef} disabled={isMobile}> <Draggable handle='.modal-header' nodeRef={nodeRef} disabled={isMobile}>
<div className="modal-content" ref={nodeRef} <div
className='modal-content'
ref={nodeRef}
style={{ style={{
maxWidth: '300px', maxWidth: '300px',
maxHeight: '250px', maxHeight: '250px',
}}> }}
<div className="modal-header"> >
Admins for {selectedTitle ?? selectedAddress} <button className='icon' onClick={() => closeModal()} title='close' />
<button className="icon" onClick={() => closeModal()} title="close" /> <div className='modal-header' style={{ margin: '10px 10px 0px 10px' }}>
Moderators
</div> </div>
<div className='list' style={{ <div
className='list'
style={{
padding: '10px', padding: '10px',
maxHeight: '200px', maxHeight: '200px',
maxWidth: '300px', maxWidth: '300px',
@@ -62,11 +57,16 @@ const AdminListModal = ({ isOpen, closeModal, roles }) => {
overflowX: 'hidden', overflowX: 'hidden',
wordWrap: 'break-word', wordWrap: 'break-word',
wordBreak: 'break-all', wordBreak: 'break-all',
}}> }}
>
<BoardForm selectedStyle={selectedStyle} style={{ all: 'unset' }}> <BoardForm selectedStyle={selectedStyle} style={{ all: 'unset' }}>
{rolesList.map(({ address, role }, index) => ( {rolesList.map(({ address, role }, index) => (
<p key={index}> <p key={index}>
<Link to={() => {}} className="quote-link">u/{address}</Link>: {role} {' '}
<Link to={() => {}} className='quote-link'>
u/{address}
</Link>
: {role}
</p> </p>
))} ))}
</BoardForm> </BoardForm>
+26 -21
View File
@@ -15,7 +15,8 @@ export const Container = styled.div`
export const NavBar = styled.div` export const NavBar = styled.div`
@media (min-width: 480px) { @media (min-width: 480px) {
.board-select, .page-jump { .board-select,
.page-jump {
display: none; display: none;
} }
@@ -33,7 +34,8 @@ export const NavBar = styled.div`
} }
@media (max-width: 480px) { @media (max-width: 480px) {
.boardList, .nav { .boardList,
.nav {
display: none; display: none;
} }
@@ -224,7 +226,8 @@ export const NavBar = styled.div`
default: default:
return ''; return '';
} }
}}`; }}
`;
export const Header = styled.div` export const Header = styled.div`
${({ selectedStyle }) => { ${({ selectedStyle }) => {
@@ -472,7 +475,7 @@ export const Break = styled.hr`
export const PostFormLink = styled.div` export const PostFormLink = styled.div`
@media (min-width: 480px) { @media (min-width: 480px) {
display: ${props => (props.showPostFormLink ? 'block' : 'none')}; display: ${(props) => (props.showPostFormLink ? 'block' : 'none')};
#post-form-link-mobile { #post-form-link-mobile {
display: none; display: none;
@@ -480,7 +483,7 @@ export const PostFormLink = styled.div`
} }
@media (max-width: 480px) { @media (max-width: 480px) {
display: ${props => (props.showPostFormLink ? 'block' : 'none')}; display: ${(props) => (props.showPostFormLink ? 'block' : 'none')};
line-height: 30px; line-height: 30px;
#post-form-link-desktop { #post-form-link-desktop {
@@ -628,7 +631,7 @@ export const PostFormLink = styled.div`
`; `;
export const PostFormTable = styled.table` export const PostFormTable = styled.table`
display: ${props => (props.showPostForm ? 'table' : 'none')}; display: ${(props) => (props.showPostForm ? 'table' : 'none')};
width: 418px; width: 418px;
border-spacing: 1px; border-spacing: 1px;
margin-left: auto; margin-left: auto;
@@ -1153,7 +1156,7 @@ export const PostFormTable = styled.table`
#t-help { #t-help {
margin: 0; margin: 0;
margin-top: -5px margin-top: -5px;
} }
`; `;
@@ -1407,7 +1410,7 @@ export const TopBar = styled.div`
} }
.ellipsis:after { .ellipsis:after {
content: "\\2026"; content: '\\2026';
position: absolute; position: absolute;
-webkit-animation: ellipsis steps(4, end) 1200ms infinite; -webkit-animation: ellipsis steps(4, end) 1200ms infinite;
animation: ellipsis steps(4, end) 1500ms infinite; animation: ellipsis steps(4, end) 1500ms infinite;
@@ -1441,7 +1444,7 @@ export const TopBar = styled.div`
max-width: calc(100vw - 50vw); max-width: calc(100vw - 50vw);
word-wrap: break-word; word-wrap: break-word;
white-space: nowrap; white-space: nowrap;
text-overflow: ""; text-overflow: '';
overflow: hidden; overflow: hidden;
} }
@@ -1450,7 +1453,7 @@ export const TopBar = styled.div`
} }
.ellipsis-all:after { .ellipsis-all:after {
content: "\\2026"; content: '\\2026';
position: absolute; position: absolute;
-webkit-animation: ellipsis steps(4, end) 1200ms infinite; -webkit-animation: ellipsis steps(4, end) 1200ms infinite;
animation: ellipsis steps(4, end) 1500ms infinite; animation: ellipsis steps(4, end) 1500ms infinite;
@@ -1494,7 +1497,7 @@ export const TopBar = styled.div`
max-width: 90vw; max-width: 90vw;
word-wrap: break-word; word-wrap: break-word;
white-space: nowrap; white-space: nowrap;
text-overflow: ""; text-overflow: '';
overflow: hidden; overflow: hidden;
} }
@@ -1503,7 +1506,7 @@ export const TopBar = styled.div`
} }
.ellipsis-all:after { .ellipsis-all:after {
content: "\\2026"; content: '\\2026';
position: absolute; position: absolute;
-webkit-animation: ellipsis steps(4, end) 1200ms infinite; -webkit-animation: ellipsis steps(4, end) 1200ms infinite;
animation: ellipsis steps(4, end) 1500ms infinite; animation: ellipsis steps(4, end) 1500ms infinite;
@@ -1695,8 +1698,12 @@ export const BoardForm = styled.div`
margin-right: 14px; margin-right: 14px;
} }
.capcode-admin {
color: red !important;
}
.ellipsis:after { .ellipsis:after {
content: "\\2026"; content: '\\2026';
position: absolute; position: absolute;
-webkit-animation: ellipsis steps(4, end) 1200ms infinite; -webkit-animation: ellipsis steps(4, end) 1200ms infinite;
animation: ellipsis steps(4, end) 1500ms infinite; animation: ellipsis steps(4, end) 1500ms infinite;
@@ -1944,7 +1951,6 @@ export const BoardForm = styled.div`
} }
}`; }`;
default: default:
return ''; return '';
} }
@@ -2047,7 +2053,7 @@ export const BoardForm = styled.div`
float: left !important; float: left !important;
font-weight: 700 !important; font-weight: 700 !important;
opacity: 1 !important; opacity: 1 !important;
height: .5em !important; height: 0.5em !important;
font-size: 16px !important; font-size: 16px !important;
} }
@@ -2212,7 +2218,7 @@ export const BoardForm = styled.div`
float: left !important; float: left !important;
font-weight: 700 !important; font-weight: 700 !important;
opacity: 1 !important; opacity: 1 !important;
height: .5em !important; height: 0.5em !important;
font-size: 16px !important; font-size: 16px !important;
} }
@@ -2225,7 +2231,8 @@ export const BoardForm = styled.div`
float: right; float: right;
text-align: right; text-align: right;
a, #reply-button { a,
#reply-button {
text-decoration: none; text-decoration: none;
} }
} }
@@ -2236,7 +2243,6 @@ export const BoardForm = styled.div`
margin: 10px !important; margin: 10px !important;
} }
} }
} }
${({ selectedStyle }) => { ${({ selectedStyle }) => {
@@ -4090,7 +4096,7 @@ export const PostMenu = styled.div`
display: inline-block; display: inline-block;
cursor: pointer; cursor: pointer;
transition: transform 0.1s; transition: transform 0.1s;
transform: ${props => props.rotated ? 'rotate(90deg)' : 'none'}; transform: ${(props) => (props.rotated ? 'rotate(90deg)' : 'none')};
`; `;
export const PostMenuMobile = styled.div` export const PostMenuMobile = styled.div`
@@ -4098,7 +4104,6 @@ export const PostMenuMobile = styled.div`
line-height: 2.5em; line-height: 2.5em;
width: 216px; width: 216px;
ul { ul {
border-right-width: 2px !important; border-right-width: 2px !important;
list-style: none; list-style: none;
@@ -4218,6 +4223,6 @@ export const PostMenuMobile = styled.div`
default: default:
return ''; return '';
}}
} }
}}
`; `;
+26 -18
View File
@@ -2,15 +2,17 @@ import styled from 'styled-components';
export const ReplyFormLink = styled.div` export const ReplyFormLink = styled.div`
@media (min-width: 480px) { @media (min-width: 480px) {
display: ${props => (props.showReplyFormLink ? 'block' : 'none')}; display: ${(props) => (props.showReplyFormLink ? 'block' : 'none')};
#post-form-link-mobile, #return-button-mobile, #catalog-button-mobile, #bottom-button-mobile { #post-form-link-mobile,
#return-button-mobile,
#catalog-button-mobile,
#bottom-button-mobile {
display: none; display: none;
} }
} }
@media (max-width: 480px) { @media (max-width: 480px) {
#post-form-link-desktop { #post-form-link-desktop {
display: none; display: none;
} }
@@ -24,7 +26,10 @@ export const ReplyFormLink = styled.div`
padding-top: 10px; padding-top: 10px;
} }
#return-button-mobile, #catalog-button-mobile, #bottom-button-mobile, #bottom-bar-top { #return-button-mobile,
#catalog-button-mobile,
#bottom-button-mobile,
#bottom-bar-top {
font-size: 10pt; font-size: 10pt;
display: inline-block; display: inline-block;
margin: 0 2px; margin: 0 2px;
@@ -186,7 +191,7 @@ export const TopBar = styled.div`
max-width: calc(100vw - 50vw); max-width: calc(100vw - 50vw);
word-wrap: break-word; word-wrap: break-word;
white-space: nowrap; white-space: nowrap;
text-overflow: ""; text-overflow: '';
overflow: hidden; overflow: hidden;
} }
@@ -195,7 +200,7 @@ export const TopBar = styled.div`
} }
.ellipsis-all:after { .ellipsis-all:after {
content: "\\2026"; content: '\\2026';
position: absolute; position: absolute;
-webkit-animation: ellipsis steps(4, end) 1200ms infinite; -webkit-animation: ellipsis steps(4, end) 1200ms infinite;
animation: ellipsis steps(4, end) 1500ms infinite; animation: ellipsis steps(4, end) 1500ms infinite;
@@ -237,7 +242,7 @@ export const TopBar = styled.div`
max-width: 90vw; max-width: 90vw;
word-wrap: break-word; word-wrap: break-word;
white-space: nowrap; white-space: nowrap;
text-overflow: ""; text-overflow: '';
overflow: hidden; overflow: hidden;
} }
@@ -246,7 +251,7 @@ export const TopBar = styled.div`
} }
.ellipsis-all:after { .ellipsis-all:after {
content: "\\2026"; content: '\\2026';
position: absolute; position: absolute;
-webkit-animation: ellipsis steps(4, end) 1200ms infinite; -webkit-animation: ellipsis steps(4, end) 1200ms infinite;
animation: ellipsis steps(4, end) 1500ms infinite; animation: ellipsis steps(4, end) 1500ms infinite;
@@ -256,7 +261,9 @@ export const TopBar = styled.div`
line-height: 30px; line-height: 30px;
#return-button-desktop, #catalog-button-desktop, #bottom-button-desktop { #return-button-desktop,
#catalog-button-desktop,
#bottom-button-desktop {
display: none; display: none;
} }
@@ -293,7 +300,7 @@ export const TopBar = styled.div`
} }
.ellipsis:after { .ellipsis:after {
content: "\\2026"; content: '\\2026';
position: absolute; position: absolute;
-webkit-animation: ellipsis steps(4, end) 1200ms infinite; -webkit-animation: ellipsis steps(4, end) 1200ms infinite;
animation: ellipsis steps(4, end) 1500ms infinite; animation: ellipsis steps(4, end) 1500ms infinite;
@@ -709,7 +716,7 @@ export const BottomBar = styled.div`
} }
.ellipsis:after { .ellipsis:after {
content: "\\2026"; content: '\\2026';
position: absolute; position: absolute;
-webkit-animation: ellipsis steps(4, end) 1200ms infinite; -webkit-animation: ellipsis steps(4, end) 1200ms infinite;
animation: ellipsis steps(4, end) 1500ms infinite; animation: ellipsis steps(4, end) 1500ms infinite;
@@ -899,8 +906,12 @@ export const BoardForm = styled.div`
margin-right: 14px; margin-right: 14px;
} }
.capcode-admin {
color: red !important;
}
.ellipsis:after { .ellipsis:after {
content: "\\2026"; content: '\\2026';
position: absolute; position: absolute;
-webkit-animation: ellipsis steps(4, end) 1200ms infinite; -webkit-animation: ellipsis steps(4, end) 1200ms infinite;
animation: ellipsis steps(4, end) 1500ms infinite; animation: ellipsis steps(4, end) 1500ms infinite;
@@ -1170,7 +1181,6 @@ export const BoardForm = styled.div`
max-width: 125px; max-width: 125px;
max-height: 125px; max-height: 125px;
} }
} }
.thread-mobile { .thread-mobile {
@@ -1213,7 +1223,7 @@ export const BoardForm = styled.div`
float: left !important; float: left !important;
font-weight: 700 !important; font-weight: 700 !important;
opacity: 1 !important; opacity: 1 !important;
height: .5em !important; height: 0.5em !important;
font-size: 16px !important; font-size: 16px !important;
} }
@@ -1250,7 +1260,6 @@ export const BoardForm = styled.div`
display: block !important; display: block !important;
clear: left !important; clear: left !important;
} }
} }
video { video {
@@ -1361,7 +1370,7 @@ export const BoardForm = styled.div`
float: left !important; float: left !important;
font-weight: 700 !important; font-weight: 700 !important;
opacity: 1 !important; opacity: 1 !important;
height: .5em !important; height: 0.5em !important;
font-size: 16px !important; font-size: 16px !important;
} }
@@ -1385,7 +1394,6 @@ export const BoardForm = styled.div`
margin: 10px !important; margin: 10px !important;
} }
} }
} }
${({ selectedStyle }) => { ${({ selectedStyle }) => {
@@ -3207,7 +3215,7 @@ export const Footer = styled.div`
#version { #version {
text-align: center; text-align: center;
font-size: 11px; font-size: 11px;
font-family: "arial"; font-family: 'arial';
} }
@media (min-width: 480px) { @media (min-width: 480px) {
#break { #break {
+9 -9
View File
@@ -990,7 +990,7 @@ const Board = () => {
setIsAdminListOpen(!isAdminListOpen); setIsAdminListOpen(!isAdminListOpen);
}} }}
> >
## Board Admins ## Board Mods
</span> </span>
&nbsp; &nbsp;
<span <span
@@ -1149,13 +1149,13 @@ const Board = () => {
)} )}
<span className='name-block-mobile'> <span className='name-block-mobile'>
<span <span
className='name-mobile capcode' className='name-mobile capcode-admin'
style={{ cursor: 'pointer' }} style={{ cursor: 'pointer' }}
onClick={() => { onClick={() => {
setIsAdminListOpen(!isAdminListOpen); setIsAdminListOpen(!isAdminListOpen);
}} }}
> >
## Board Admins ## Board Mods
</span> </span>
&nbsp; &nbsp;
<span className='thread-icons-mobile' style={{ float: 'right', marginRight: '18px' }}> <span className='thread-icons-mobile' style={{ float: 'right', marginRight: '18px' }}>
@@ -1215,7 +1215,7 @@ const Board = () => {
setIsAdminListOpen(!isAdminListOpen); setIsAdminListOpen(!isAdminListOpen);
}} }}
> >
## Board Admins ## Board Mods
</span> </span>
&nbsp; &nbsp;
<span <span
@@ -1374,13 +1374,13 @@ const Board = () => {
)} )}
<span className='name-block-mobile'> <span className='name-block-mobile'>
<span <span
className='name-mobile capcode' className='name-mobile capcode-admin'
style={{ cursor: 'pointer' }} style={{ cursor: 'pointer' }}
onClick={() => { onClick={() => {
setIsAdminListOpen(!isAdminListOpen); setIsAdminListOpen(!isAdminListOpen);
}} }}
> >
## Board Admins ## Board Mods
</span> </span>
&nbsp; &nbsp;
<span className='thread-icons-mobile' style={{ float: 'right', marginRight: '18px' }}> <span className='thread-icons-mobile' style={{ float: 'right', marginRight: '18px' }}>
@@ -1457,7 +1457,7 @@ const Board = () => {
setIsAdminListOpen(!isAdminListOpen); setIsAdminListOpen(!isAdminListOpen);
}} }}
> >
## Board Admins ## Board Mods
</span> </span>
&nbsp; &nbsp;
<span <span
@@ -1675,13 +1675,13 @@ const Board = () => {
)} )}
<span className='name-block-mobile'> <span className='name-block-mobile'>
<span <span
className='name-mobile capcode' className='name-mobile capcode-admin'
style={{ cursor: 'pointer' }} style={{ cursor: 'pointer' }}
onClick={() => { onClick={() => {
setIsAdminListOpen(!isAdminListOpen); setIsAdminListOpen(!isAdminListOpen);
}} }}
> >
## Board Admins ## Board Mods
</span> </span>
&nbsp; &nbsp;
<span className='thread-icons-mobile' style={{ float: 'right', marginRight: '18px' }}> <span className='thread-icons-mobile' style={{ float: 'right', marginRight: '18px' }}>
+2 -2
View File
@@ -362,7 +362,7 @@ const CatalogPost = ({ post }) => {
}} }}
> >
<span className='post-subject'>Rules </span> by  <span className='post-subject'>Rules </span> by 
<span className='post-author-admin'> ## Board Admins </span> <span className='post-author-admin'> ## Board Mods </span>
<span className='post-ago'>{thread.timestamp ? getFormattedTime(thread.timestamp) : null}</span> <span className='post-ago'>{thread.timestamp ? getFormattedTime(thread.timestamp) : null}</span>
</div> </div>
</PostPreview>, </PostPreview>,
@@ -530,7 +530,7 @@ const CatalogPost = ({ post }) => {
}} }}
> >
<span className='post-subject'>Welcome to {subplebbit.title || subplebbit.address}</span> by  <span className='post-subject'>Welcome to {subplebbit.title || subplebbit.address}</span> by 
<span className='post-author-admin'> ## Board Admins </span> <span className='post-author-admin'> ## Board Mods </span>
<span className='post-ago'>{thread.timestamp ? getFormattedTime(thread.timestamp) : null}</span> <span className='post-ago'>{thread.timestamp ? getFormattedTime(thread.timestamp) : null}</span>
</div> </div>
</PostPreview>, </PostPreview>,
+3 -3
View File
@@ -382,7 +382,7 @@ const Description = () => {
setIsAdminListOpen(!isAdminListOpen); setIsAdminListOpen(!isAdminListOpen);
}} }}
> >
## Board Admins ## Board Mods
</span> </span>
&nbsp; &nbsp;
<span className='date-time'>{getDate(subplebbit.createdAt)}</span> <span className='date-time'>{getDate(subplebbit.createdAt)}</span>
@@ -596,13 +596,13 @@ const Description = () => {
)} )}
<span className='name-block-mobile'> <span className='name-block-mobile'>
<span <span
className='name-mobile capcode' className='name-mobile capcode-admin'
style={{ cursor: 'pointer' }} style={{ cursor: 'pointer' }}
onClick={() => { onClick={() => {
setIsAdminListOpen(!isAdminListOpen); setIsAdminListOpen(!isAdminListOpen);
}} }}
> >
## Board Admins ## Board Mods
</span> </span>
&nbsp; &nbsp;
<span className='thread-icons-mobile' style={{ float: 'right', marginRight: '18px' }}> <span className='thread-icons-mobile' style={{ float: 'right', marginRight: '18px' }}>
+3 -3
View File
@@ -370,7 +370,7 @@ const Rules = () => {
setIsAdminListOpen(!isAdminListOpen); setIsAdminListOpen(!isAdminListOpen);
}} }}
> >
## Board Admins ## Board Mods
</span> </span>
&nbsp; &nbsp;
<span className='date-time'>{getDate(subplebbit.createdAt)}</span> <span className='date-time'>{getDate(subplebbit.createdAt)}</span>
@@ -530,13 +530,13 @@ const Rules = () => {
)} )}
<span className='name-block-mobile'> <span className='name-block-mobile'>
<span <span
className='name-mobile capcode' className='name-mobile capcode-admin'
style={{ cursor: 'pointer' }} style={{ cursor: 'pointer' }}
onClick={() => { onClick={() => {
setIsAdminListOpen(!isAdminListOpen); setIsAdminListOpen(!isAdminListOpen);
}} }}
> >
## Board Admins ## Board Mods
</span> </span>
&nbsp; &nbsp;
<span className='thread-icons-mobile' style={{ float: 'right', marginRight: '18px' }}> <span className='thread-icons-mobile' style={{ float: 'right', marginRight: '18px' }}>
+1 -1
View File
@@ -1096,7 +1096,7 @@ const Thread = () => {
Anonymous Anonymous
</span> </span>
)} )}
&nbsp; &nbsp; &nbsp;
<span <span
className='poster-address address-desktop' className='poster-address address-desktop'
id='reply-button' id='reply-button'