mirror of
https://github.com/roleypoly/roleypoly-v1.git
synced 2025-06-14 17:49:08 +00:00
chore: prettier UI
This commit is contained in:
parent
1f03e1bb11
commit
d08c9e4829
9 changed files with 36 additions and 26 deletions
|
@ -1,7 +1,7 @@
|
||||||
import superagent from 'superagent'
|
import superagent from 'superagent'
|
||||||
import { history } from '../router/history'
|
import { history } from '../router/history'
|
||||||
|
|
||||||
export const fetchServers = async dispatch => {
|
export const fetchServers = async (dispatch) => {
|
||||||
const rsp = await superagent.get('/api/servers')
|
const rsp = await superagent.get('/api/servers')
|
||||||
|
|
||||||
dispatch({
|
dispatch({
|
||||||
|
@ -14,7 +14,7 @@ export const fetchServers = async dispatch => {
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
export const userInit = async dispatch => {
|
export const userInit = async (dispatch) => {
|
||||||
if (!window.location.pathname.startsWith('/oauth')) {
|
if (!window.location.pathname.startsWith('/oauth')) {
|
||||||
try {
|
try {
|
||||||
const rsp = await superagent.get('/api/auth/user')
|
const rsp = await superagent.get('/api/auth/user')
|
||||||
|
@ -38,7 +38,7 @@ export const userInit = async dispatch => {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export const userLogout = async dispatch => {
|
export const userLogout = async (dispatch) => {
|
||||||
try {
|
try {
|
||||||
await superagent.post('/api/auth/logout')
|
await superagent.post('/api/auth/logout')
|
||||||
} catch (e) {}
|
} catch (e) {}
|
||||||
|
@ -50,7 +50,7 @@ export const userLogout = async dispatch => {
|
||||||
window.location.href = '/'
|
window.location.href = '/'
|
||||||
}
|
}
|
||||||
|
|
||||||
export const startServerPolling = dispatch => {
|
export const startServerPolling = (dispatch) => {
|
||||||
return poll(window.__APP_STORE__.dispatch, window.__APP_STORE__.getState) // let's not cheat... :c
|
return poll(window.__APP_STORE__.dispatch, window.__APP_STORE__.getState) // let's not cheat... :c
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
export const fadeOut = cb => dispatch => {
|
export const fadeOut = (cb) => (dispatch) => {
|
||||||
dispatch({
|
dispatch({
|
||||||
type: Symbol.for('app fade'),
|
type: Symbol.for('app fade'),
|
||||||
data: true,
|
data: true,
|
||||||
|
|
|
@ -17,7 +17,7 @@ class Category extends Component {
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
onRoleToggle = id => (next, old) => {
|
onRoleToggle = (id) => (next, old) => {
|
||||||
const type = this.props.category.get('type')
|
const type = this.props.category.get('type')
|
||||||
|
|
||||||
switch (type) {
|
switch (type) {
|
||||||
|
@ -45,7 +45,7 @@ class Category extends Component {
|
||||||
<h4>{category.get('name')}</h4>
|
<h4>{category.get('name')}</h4>
|
||||||
{category
|
{category
|
||||||
.get('roles_map')
|
.get('roles_map')
|
||||||
.sortBy(r => r.get('position'))
|
.sortBy((r) => r.get('position'))
|
||||||
.reverse()
|
.reverse()
|
||||||
.map((r, k) => {
|
.map((r, k) => {
|
||||||
const id = r.get('id')
|
const id = r.get('id')
|
||||||
|
|
|
@ -8,7 +8,6 @@ import discordLogo from '../../pages/images/discord-logo.svg'
|
||||||
let specialFills = {}
|
let specialFills = {}
|
||||||
let showTransFlag = false
|
let showTransFlag = false
|
||||||
|
|
||||||
|
|
||||||
class Wrapper extends Component {
|
class Wrapper extends Component {
|
||||||
render() {
|
render() {
|
||||||
const date = new Date()
|
const date = new Date()
|
||||||
|
@ -18,7 +17,7 @@ class Wrapper extends Component {
|
||||||
) {
|
) {
|
||||||
specialFills = {
|
specialFills = {
|
||||||
circleFill: '#FFAEC6',
|
circleFill: '#FFAEC6',
|
||||||
typeFill: '#6FDCFF'
|
typeFill: '#6FDCFF',
|
||||||
}
|
}
|
||||||
showTransFlag = true
|
showTransFlag = true
|
||||||
}
|
}
|
||||||
|
@ -31,7 +30,18 @@ class Wrapper extends Component {
|
||||||
<div className="uk-navbar-left">
|
<div className="uk-navbar-left">
|
||||||
<Link to="/">
|
<Link to="/">
|
||||||
<div style={{ display: 'flex' }}>
|
<div style={{ display: 'flex' }}>
|
||||||
<Logotype style={{ height: '2rem', marginRight: '12px' }} className="wrapper__logotype" {...specialFills} /> {showTransFlag && <TransFlag height="100%" width="75px" uk-tooltip="pos: bottom; title: Roleypoly says trans rights!" />}
|
<Logotype
|
||||||
|
style={{ height: '2rem', marginRight: '12px' }}
|
||||||
|
className="wrapper__logotype"
|
||||||
|
{...specialFills}
|
||||||
|
/>{' '}
|
||||||
|
{showTransFlag && (
|
||||||
|
<TransFlag
|
||||||
|
height="100%"
|
||||||
|
width="75px"
|
||||||
|
uk-tooltip="pos: bottom; title: Roleypoly says trans rights!"
|
||||||
|
/>
|
||||||
|
)}
|
||||||
</div>
|
</div>
|
||||||
</Link>
|
</Link>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -8,7 +8,7 @@ import Error404 from './Error404'
|
||||||
export { default as Landing } from './Landing'
|
export { default as Landing } from './Landing'
|
||||||
export { default as Error404 } from './Error404'
|
export { default as Error404 } from './Error404'
|
||||||
|
|
||||||
const Pages = props => {
|
const Pages = (props) => {
|
||||||
return (
|
return (
|
||||||
<div className="pages">
|
<div className="pages">
|
||||||
<Scrollbars autoHeight autoHeightMax="calc(100vh - 80px)">
|
<Scrollbars autoHeight autoHeightMax="calc(100vh - 80px)">
|
||||||
|
|
|
@ -46,7 +46,7 @@ export default function register() {
|
||||||
function registerValidSW(swUrl) {
|
function registerValidSW(swUrl) {
|
||||||
navigator.serviceWorker
|
navigator.serviceWorker
|
||||||
.register(swUrl)
|
.register(swUrl)
|
||||||
.then(registration => {
|
.then((registration) => {
|
||||||
registration.onupdatefound = () => {
|
registration.onupdatefound = () => {
|
||||||
const installingWorker = registration.installing
|
const installingWorker = registration.installing
|
||||||
installingWorker.onstatechange = () => {
|
installingWorker.onstatechange = () => {
|
||||||
|
@ -67,7 +67,7 @@ function registerValidSW(swUrl) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.catch(error => {
|
.catch((error) => {
|
||||||
console.error('Error during service worker registration:', error)
|
console.error('Error during service worker registration:', error)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
@ -75,14 +75,14 @@ function registerValidSW(swUrl) {
|
||||||
function checkValidServiceWorker(swUrl) {
|
function checkValidServiceWorker(swUrl) {
|
||||||
// Check if the service worker can be found. If it can't reload the page.
|
// Check if the service worker can be found. If it can't reload the page.
|
||||||
fetch(swUrl)
|
fetch(swUrl)
|
||||||
.then(response => {
|
.then((response) => {
|
||||||
// Ensure service worker exists, and that we really are getting a JS file.
|
// Ensure service worker exists, and that we really are getting a JS file.
|
||||||
if (
|
if (
|
||||||
response.status === 404 ||
|
response.status === 404 ||
|
||||||
response.headers.get('content-type').indexOf('javascript') === -1
|
response.headers.get('content-type').indexOf('javascript') === -1
|
||||||
) {
|
) {
|
||||||
// No service worker found. Probably a different app. Reload the page.
|
// No service worker found. Probably a different app. Reload the page.
|
||||||
navigator.serviceWorker.ready.then(registration => {
|
navigator.serviceWorker.ready.then((registration) => {
|
||||||
registration.unregister().then(() => {
|
registration.unregister().then(() => {
|
||||||
window.location.reload()
|
window.location.reload()
|
||||||
})
|
})
|
||||||
|
@ -99,7 +99,7 @@ function checkValidServiceWorker(swUrl) {
|
||||||
|
|
||||||
export function unregister() {
|
export function unregister() {
|
||||||
if ('serviceWorker' in navigator) {
|
if ('serviceWorker' in navigator) {
|
||||||
navigator.serviceWorker.ready.then(registration => {
|
navigator.serviceWorker.ready.then((registration) => {
|
||||||
registration.unregister()
|
registration.unregister()
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,7 +3,7 @@ import { createLogger } from 'redux-logger'
|
||||||
import thunk from 'redux-thunk'
|
import thunk from 'redux-thunk'
|
||||||
import rootReducer from '../reducers'
|
import rootReducer from '../reducers'
|
||||||
|
|
||||||
const configureStore = preloadedState => {
|
const configureStore = (preloadedState) => {
|
||||||
const store = createStore(
|
const store = createStore(
|
||||||
rootReducer,
|
rootReducer,
|
||||||
preloadedState,
|
preloadedState,
|
||||||
|
|
|
@ -4,7 +4,7 @@ import thunk from 'redux-thunk'
|
||||||
// import api from '../middleware/api'
|
// import api from '../middleware/api'
|
||||||
import rootReducer from '../reducers'
|
import rootReducer from '../reducers'
|
||||||
|
|
||||||
const configureStore = preloadedState =>
|
const configureStore = (preloadedState) =>
|
||||||
createStore(rootReducer, preloadedState, applyMiddleware(thunk))
|
createStore(rootReducer, preloadedState, applyMiddleware(thunk))
|
||||||
|
|
||||||
export default configureStore
|
export default configureStore
|
||||||
|
|
|
@ -1,11 +1,11 @@
|
||||||
import color from 'color'
|
import color from 'color'
|
||||||
|
|
||||||
export const msgToReal = msg => msg.replace(/</g, '<').replace(/\n/g, '<br />')
|
export const msgToReal = (msg) => msg.replace(/</g, '<').replace(/\n/g, '<br />')
|
||||||
|
|
||||||
export const colorToCSS = colorInt => {
|
export const colorToCSS = (colorInt) => {
|
||||||
if (colorInt === 0) {
|
if (colorInt === 0) {
|
||||||
return '#fff'
|
return '#fff'
|
||||||
}
|
}
|
||||||
|
|
||||||
return color(colorInt).hsl().string()
|
return color(colorInt).hsl().string()
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue