mirror of
https://github.com/roleypoly/roleypoly-v1.git
synced 2025-06-16 10:19:10 +00:00
sync
This commit is contained in:
parent
13cd3bd4a0
commit
52cb96baa3
43 changed files with 3257 additions and 1072 deletions
|
@ -1,13 +1,18 @@
|
|||
import React, { Component, Fragment } from 'react'
|
||||
import Radium from 'radium'
|
||||
import serverStyles, { navigation as styles } from './styles'
|
||||
|
||||
import PropTypes from 'prop-types'
|
||||
import ServerCard from './ServerCard'
|
||||
import UserCard from './UserCard'
|
||||
|
||||
class ServersNavigation extends Component {
|
||||
|
||||
static propTypes = {
|
||||
user: PropTypes.object.isRequired,
|
||||
servers: PropTypes.arrayOf(PropTypes.object).isRequired,
|
||||
className: PropTypes.string
|
||||
}
|
||||
|
||||
render () {
|
||||
console.log(this.props.servers)
|
||||
// console.log(this.props.servers)
|
||||
return <Fragment>
|
||||
<UserCard user={this.props.user} />
|
||||
<div className={this.props.className}>
|
||||
|
@ -17,4 +22,4 @@ class ServersNavigation extends Component {
|
|||
}
|
||||
}
|
||||
|
||||
export default Radium(ServersNavigation)
|
||||
export default ServersNavigation
|
||||
|
|
|
@ -1,47 +0,0 @@
|
|||
.server-list__item {
|
||||
display: flex;
|
||||
/* border-bottom: 1px solid var(--c-3); */
|
||||
padding: 25px 15px;
|
||||
padding-right: 0;
|
||||
align-items: center;
|
||||
/* justify-content: center; */
|
||||
}
|
||||
|
||||
a.server-list__item {
|
||||
color: var(--c-white);
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
a.server-list__item.active {
|
||||
cursor: default
|
||||
}
|
||||
|
||||
.server-list__item.active {
|
||||
background-color: var(--c-3);
|
||||
}
|
||||
|
||||
.server-list__item:hover:not(.active) {
|
||||
background-color: rgba(0,0,0,0.25) !important;
|
||||
cursor: pointer;
|
||||
transform: translateX(1px);
|
||||
transition: background 0.05s ease-in-out, transform 0.1s ease-in-out;
|
||||
}
|
||||
|
||||
.server-list__item:last-of-type {
|
||||
border: 0
|
||||
}
|
||||
|
||||
.server-list__item:nth-of-type(even):not(.active) {
|
||||
background-color: rgba(0,0,0,0.1);
|
||||
}
|
||||
|
||||
.server-list__item__icon img {
|
||||
border-radius: 100%;
|
||||
width: 50px;
|
||||
height: 50px;
|
||||
border: 2px solid transparent;
|
||||
}
|
||||
|
||||
.server-list__item__info {
|
||||
padding: 0 10px
|
||||
}
|
|
@ -1,25 +1,25 @@
|
|||
import React, { Component } from 'react'
|
||||
import { NavLink } from 'react-router-dom'
|
||||
import Radium from 'radium'
|
||||
import './ServerCard.css'
|
||||
import './ServerCard.sass'
|
||||
|
||||
class ServerCard extends Component {
|
||||
render () {
|
||||
const { server: { server, id, gm, perms }, user } = this.props
|
||||
|
||||
let icon = ''
|
||||
|
||||
|
||||
if (perms.canManageRoles) {
|
||||
icon = <span title='Role Manager' uk-tooltip=''>🔰</span>
|
||||
icon = <span title='Role Manager' uk-tooltip='' role='img' aria-label='Role Manager'>🔰</span>
|
||||
}
|
||||
|
||||
if (perms.isAdmin) {
|
||||
icon = <span title='Server Admin' uk-tooltip=''>🔰⭐️</span>
|
||||
icon = <span title='Server Admin' uk-tooltip='' role='img' aria-label='Server Admin'>🔰⭐️</span>
|
||||
}
|
||||
|
||||
return <NavLink className='server-list__item' activeClassName='active' to={`/s/${id}`}>
|
||||
<div className='server-list__item__icon'>
|
||||
<img src={`https://cdn.discordapp.com/icons/${id}/${server.icon}.png`} />
|
||||
<img src={`https://cdn.discordapp.com/icons/${id}/${server.icon}.png`} alt={server.name} />
|
||||
</div>
|
||||
<div className='server-list__item__info'>
|
||||
<b>{server.name}</b><br />
|
||||
|
|
41
UI/src/components/servers/ServerCard.sass
Normal file
41
UI/src/components/servers/ServerCard.sass
Normal file
|
@ -0,0 +1,41 @@
|
|||
.server-list
|
||||
&__item
|
||||
display: flex
|
||||
/* border-bottom: 1px solid var(--c-3) */
|
||||
padding: 25px 15px
|
||||
padding-right: 0
|
||||
align-items: center
|
||||
/* justify-content: center */
|
||||
|
||||
.active
|
||||
background-color: var(--c-3)
|
||||
|
||||
&:hover:not(.active)
|
||||
background-color: rgba(0,0,0,0.25) !important
|
||||
cursor: pointer
|
||||
transform: translateX(1px)
|
||||
transition: background 0.05s ease-in-out, transform 0.1s ease-in-out
|
||||
|
||||
&:nth-of-type(even)
|
||||
background-color: rgba(0,0,0,0.1)
|
||||
|
||||
&:last-of-type
|
||||
border: 0
|
||||
|
||||
&__icon img
|
||||
border-radius: 100%
|
||||
width: 50px
|
||||
height: 50px
|
||||
border: 2px solid transparent
|
||||
|
||||
&__info
|
||||
padding: 0 10px
|
||||
|
||||
a.server-list__item
|
||||
color: var(--c-white)
|
||||
text-decoration: none
|
||||
|
||||
.active
|
||||
cursor: default
|
||||
|
||||
|
|
@ -1,53 +0,0 @@
|
|||
.user-card {
|
||||
position: relative;
|
||||
display: flex;
|
||||
background-color: rgba(0,0,0,0.3);
|
||||
/* border-bottom: 1px solid var(--c-3); */
|
||||
padding: 25px 15px;
|
||||
grid-area: user;
|
||||
}
|
||||
|
||||
.user-card__icon img {
|
||||
width: 50px;
|
||||
height: 50px;
|
||||
border-radius: 100%;
|
||||
border: 2px solid #5fc66d;
|
||||
}
|
||||
|
||||
.user-card__info {
|
||||
padding: 0 10px;
|
||||
line-height: 50px
|
||||
}
|
||||
|
||||
.user-card__info__discrim {
|
||||
font-weight: 100;
|
||||
font-size: 0.7rem;
|
||||
color: var(--c-7);
|
||||
}
|
||||
|
||||
.user-card__info__name {
|
||||
/* font-size */
|
||||
/* font-weight: ; */
|
||||
}
|
||||
|
||||
.user-card__actions {
|
||||
position: absolute;
|
||||
right: 5px;
|
||||
top: 5px;
|
||||
bottom: 5px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
.user-card__actions svg {
|
||||
transition: transform 0.05s ease-in-out;
|
||||
}
|
||||
|
||||
.user-card__actions svg:hover {
|
||||
transform: scale(1.15);
|
||||
}
|
||||
|
||||
.user-card__actions polygon {
|
||||
fill: var(--c-7);
|
||||
}
|
|
@ -1,18 +1,33 @@
|
|||
import React, { Component } from 'react'
|
||||
import PropTypes from 'prop-types'
|
||||
import { NavLink } from 'react-router-dom'
|
||||
import Radium from 'radium'
|
||||
import './UserCard.css'
|
||||
import './UserCard.sass'
|
||||
|
||||
class UserCard extends Component {
|
||||
static propTypes = {
|
||||
user: PropTypes.object.isRequired
|
||||
}
|
||||
|
||||
get avatar () {
|
||||
const { user } = this.props
|
||||
if (user.avatar === '' || user.avatar == null) {
|
||||
return `https://cdn.discordapp.com/embed/avatars/${Math.ceil(Math.random() * 9999) % 4}.png`
|
||||
}
|
||||
|
||||
return `https://cdn.discordapp.com/avatars/${user.id}/${user.avatar}.png`
|
||||
}
|
||||
|
||||
render () {
|
||||
const { user } = this.props
|
||||
|
||||
// console.log(this.props)
|
||||
|
||||
return <div className='user-card'>
|
||||
<div className='user-card__icon'>
|
||||
<img src={`https://cdn.discordapp.com/avatars/${user.id}/${user.avatar}.png`} />
|
||||
<img src={this.avatar} alt={user.username} />
|
||||
</div>
|
||||
<div className='user-card__info'>
|
||||
<span className='user-card__info__name'>{user.username}</span><span className='user-card__info__discrim'>#{user.discriminator}</span>
|
||||
<span className='user-card__info__name'>{user.username}</span><span className='user-card__info__discrim'>#{user.discriminator}</span>
|
||||
</div>
|
||||
<div className='user-card__actions'>
|
||||
<ul className='uk-iconnav uk-iconnav-vertical'>
|
||||
|
@ -28,4 +43,4 @@ class UserCard extends Component {
|
|||
}
|
||||
}
|
||||
|
||||
export default Radium(UserCard)
|
||||
export default UserCard
|
||||
|
|
44
UI/src/components/servers/UserCard.sass
Normal file
44
UI/src/components/servers/UserCard.sass
Normal file
|
@ -0,0 +1,44 @@
|
|||
.user-card
|
||||
position: relative
|
||||
display: flex
|
||||
background-color: var(--c-dark)
|
||||
/* border-bottom: 1px solid var(--c-3) */
|
||||
padding: 25px 15px
|
||||
grid-area: user
|
||||
|
||||
&__icon img
|
||||
width: 50px
|
||||
height: 50px
|
||||
border-radius: 100%
|
||||
border: 2px solid #5fc66d
|
||||
|
||||
&__info
|
||||
padding: 0 10px
|
||||
line-height: 50px
|
||||
|
||||
&__discrim
|
||||
font-weight: 100
|
||||
font-size: 0.7rem
|
||||
color: var(--c-7)
|
||||
|
||||
&__name
|
||||
/* font-size */
|
||||
/* font-weight: */
|
||||
|
||||
&__actions
|
||||
position: absolute
|
||||
right: 5px
|
||||
top: 5px
|
||||
bottom: 5px
|
||||
display: flex
|
||||
align-items: center
|
||||
justify-content: center
|
||||
|
||||
svg
|
||||
transition: transform 0.05s ease-in-out
|
||||
|
||||
svg:hover
|
||||
transform: scale(1.15)
|
||||
|
||||
polygon
|
||||
fill: var(--c-7)
|
|
@ -1,20 +0,0 @@
|
|||
.servers {
|
||||
display: grid;
|
||||
grid-template-rows: 100px calc(100vh - 75px);
|
||||
grid-template-columns: 300px 1fr;
|
||||
grid-template-areas: "user content"
|
||||
"listing content";
|
||||
}
|
||||
|
||||
.servers__nav {
|
||||
grid-area: listing;
|
||||
overflow-y: scroll;
|
||||
height: calc(100vh - 175px);
|
||||
}
|
||||
|
||||
.servers__content {
|
||||
grid-area: content;
|
||||
background-color: var(--c-3);
|
||||
padding: 15px;
|
||||
overflow-y: scroll;
|
||||
}
|
|
@ -1,29 +1,27 @@
|
|||
import React, { Component } from 'react'
|
||||
import { Route } from 'react-router-dom'
|
||||
import Radium from 'radium'
|
||||
import superagent from 'superagent'
|
||||
import './index.css'
|
||||
import './index.sass'
|
||||
|
||||
import Navigation from './Navigation'
|
||||
import RolePicker from '../role-picker'
|
||||
|
||||
import mockData from './mockData'
|
||||
// import mockData from './mockData'
|
||||
|
||||
class Servers extends Component {
|
||||
state = {
|
||||
user: mockData.user,
|
||||
servers: [],
|
||||
}
|
||||
|
||||
async componentWillMount () {
|
||||
const rsp = await superagent.get(`/api/~/relevant-servers/62601275618889728`)
|
||||
const rsp = await superagent.get(`/api/servers`)
|
||||
|
||||
this.setState({ servers: rsp.body })
|
||||
}
|
||||
|
||||
render () {
|
||||
return <div className="servers">
|
||||
<Navigation className="servers__nav" servers={this.state.servers} user={this.state.user} />
|
||||
<Navigation className="servers__nav" servers={[]} user={{}} />
|
||||
<div className="servers__content">
|
||||
{/* another router probably. */}
|
||||
<Route path='/s/:server' component={RolePicker} />
|
||||
<Route path='/s/:server/edit' component={RolePicker} />
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
|
|
21
UI/src/components/servers/index.sass
Normal file
21
UI/src/components/servers/index.sass
Normal file
|
@ -0,0 +1,21 @@
|
|||
.servers
|
||||
|
||||
$fullH: calc(100vh - 75px)
|
||||
|
||||
display: grid
|
||||
grid-template-rows: 100px $fullH
|
||||
grid-template-columns: 300px 1fr
|
||||
grid-template-areas: "user content" "listing content"
|
||||
|
||||
|
||||
&__nav
|
||||
grid-area: listing
|
||||
overflow-y: scroll
|
||||
height: $fullH
|
||||
|
||||
|
||||
&__content
|
||||
grid-area: content
|
||||
background-color: var(--c-3)
|
||||
padding: 15px
|
||||
overflow-y: scroll
|
Loading…
Add table
Add a link
Reference in a new issue