From d08c9e48291b0f118505ba82edf092cf95e0ed91 Mon Sep 17 00:00:00 2001 From: Kata Date: Sun, 2 Aug 2020 16:28:46 -0400 Subject: [PATCH] chore: prettier UI --- UI/src/actions/index.js | 8 ++++---- UI/src/actions/ui.js | 2 +- UI/src/components/role-picker/Category.js | 4 ++-- UI/src/components/wrapper/index.js | 16 +++++++++++++--- UI/src/pages/index.js | 2 +- UI/src/registerServiceWorker.js | 10 +++++----- UI/src/store/configureStore.dev.js | 2 +- UI/src/store/configureStore.prod.js | 2 +- UI/src/utils.js | 16 ++++++++-------- 9 files changed, 36 insertions(+), 26 deletions(-) diff --git a/UI/src/actions/index.js b/UI/src/actions/index.js index 2c038a3..bff0518 100644 --- a/UI/src/actions/index.js +++ b/UI/src/actions/index.js @@ -1,7 +1,7 @@ import superagent from 'superagent' import { history } from '../router/history' -export const fetchServers = async dispatch => { +export const fetchServers = async (dispatch) => { const rsp = await superagent.get('/api/servers') 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')) { try { 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 { await superagent.post('/api/auth/logout') } catch (e) {} @@ -50,7 +50,7 @@ export const userLogout = async dispatch => { 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 } diff --git a/UI/src/actions/ui.js b/UI/src/actions/ui.js index fd564f9..fa202c0 100644 --- a/UI/src/actions/ui.js +++ b/UI/src/actions/ui.js @@ -1,4 +1,4 @@ -export const fadeOut = cb => dispatch => { +export const fadeOut = (cb) => (dispatch) => { dispatch({ type: Symbol.for('app fade'), data: true, diff --git a/UI/src/components/role-picker/Category.js b/UI/src/components/role-picker/Category.js index 2ae47cc..4810c42 100644 --- a/UI/src/components/role-picker/Category.js +++ b/UI/src/components/role-picker/Category.js @@ -17,7 +17,7 @@ class Category extends Component { ) } - onRoleToggle = id => (next, old) => { + onRoleToggle = (id) => (next, old) => { const type = this.props.category.get('type') switch (type) { @@ -45,7 +45,7 @@ class Category extends Component {

{category.get('name')}

{category .get('roles_map') - .sortBy(r => r.get('position')) + .sortBy((r) => r.get('position')) .reverse() .map((r, k) => { const id = r.get('id') diff --git a/UI/src/components/wrapper/index.js b/UI/src/components/wrapper/index.js index a87910e..63e964c 100644 --- a/UI/src/components/wrapper/index.js +++ b/UI/src/components/wrapper/index.js @@ -8,7 +8,6 @@ import discordLogo from '../../pages/images/discord-logo.svg' let specialFills = {} let showTransFlag = false - class Wrapper extends Component { render() { const date = new Date() @@ -18,7 +17,7 @@ class Wrapper extends Component { ) { specialFills = { circleFill: '#FFAEC6', - typeFill: '#6FDCFF' + typeFill: '#6FDCFF', } showTransFlag = true } @@ -31,7 +30,18 @@ class Wrapper extends Component {
- {showTransFlag && } + {' '} + {showTransFlag && ( + + )}
diff --git a/UI/src/pages/index.js b/UI/src/pages/index.js index 5c8f109..e7ada8a 100644 --- a/UI/src/pages/index.js +++ b/UI/src/pages/index.js @@ -8,7 +8,7 @@ import Error404 from './Error404' export { default as Landing } from './Landing' export { default as Error404 } from './Error404' -const Pages = props => { +const Pages = (props) => { return (
diff --git a/UI/src/registerServiceWorker.js b/UI/src/registerServiceWorker.js index b7980a9..cde6393 100644 --- a/UI/src/registerServiceWorker.js +++ b/UI/src/registerServiceWorker.js @@ -46,7 +46,7 @@ export default function register() { function registerValidSW(swUrl) { navigator.serviceWorker .register(swUrl) - .then(registration => { + .then((registration) => { registration.onupdatefound = () => { const installingWorker = registration.installing installingWorker.onstatechange = () => { @@ -67,7 +67,7 @@ function registerValidSW(swUrl) { } } }) - .catch(error => { + .catch((error) => { console.error('Error during service worker registration:', error) }) } @@ -75,14 +75,14 @@ function registerValidSW(swUrl) { function checkValidServiceWorker(swUrl) { // Check if the service worker can be found. If it can't reload the page. fetch(swUrl) - .then(response => { + .then((response) => { // Ensure service worker exists, and that we really are getting a JS file. if ( response.status === 404 || response.headers.get('content-type').indexOf('javascript') === -1 ) { // No service worker found. Probably a different app. Reload the page. - navigator.serviceWorker.ready.then(registration => { + navigator.serviceWorker.ready.then((registration) => { registration.unregister().then(() => { window.location.reload() }) @@ -99,7 +99,7 @@ function checkValidServiceWorker(swUrl) { export function unregister() { if ('serviceWorker' in navigator) { - navigator.serviceWorker.ready.then(registration => { + navigator.serviceWorker.ready.then((registration) => { registration.unregister() }) } diff --git a/UI/src/store/configureStore.dev.js b/UI/src/store/configureStore.dev.js index dabc8ff..616bc2d 100644 --- a/UI/src/store/configureStore.dev.js +++ b/UI/src/store/configureStore.dev.js @@ -3,7 +3,7 @@ import { createLogger } from 'redux-logger' import thunk from 'redux-thunk' import rootReducer from '../reducers' -const configureStore = preloadedState => { +const configureStore = (preloadedState) => { const store = createStore( rootReducer, preloadedState, diff --git a/UI/src/store/configureStore.prod.js b/UI/src/store/configureStore.prod.js index 57beb27..f85f435 100644 --- a/UI/src/store/configureStore.prod.js +++ b/UI/src/store/configureStore.prod.js @@ -4,7 +4,7 @@ import thunk from 'redux-thunk' // import api from '../middleware/api' import rootReducer from '../reducers' -const configureStore = preloadedState => +const configureStore = (preloadedState) => createStore(rootReducer, preloadedState, applyMiddleware(thunk)) export default configureStore diff --git a/UI/src/utils.js b/UI/src/utils.js index ccf50e5..c3a3e74 100644 --- a/UI/src/utils.js +++ b/UI/src/utils.js @@ -1,11 +1,11 @@ import color from 'color' -export const msgToReal = msg => msg.replace(/') +export const msgToReal = (msg) => msg.replace(/') -export const colorToCSS = colorInt => { - if (colorInt === 0) { - return '#fff' - } - - return color(colorInt).hsl().string() -} \ No newline at end of file +export const colorToCSS = (colorInt) => { + if (colorInt === 0) { + return '#fff' + } + + return color(colorInt).hsl().string() +}