Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor(react-16): migrate to new react version #604

Merged
merged 22 commits into from
Sep 20, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions app/background/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="Content-Security-Policy" content="script-src * 'unsafe-inline';"/>
<script>
(function() {
const script = document.createElement('script');
Expand Down
20 changes: 2 additions & 18 deletions app/lib/__tests__/loadThemes.spec.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import themesLoader from '../loadThemes'
import themes from '../themes'

const productionThemes = [
{
Expand All @@ -11,22 +11,6 @@ const productionThemes = [
}
]

const developmentThemes = [
{
value: 'http://localhost:3000/dist/main/css/themes/light.css',
label: 'Light'
},
{
value: 'http://localhost:3000/dist/main/css/themes/dark.css',
label: 'Dark'
}
]

test('returns themes for production', () => {
expect(themesLoader()).toEqual(productionThemes)
})

test('returns themes for development', () => {
process.env.NODE_ENV = 'development'
expect(themesLoader()).toEqual(developmentThemes)
expect(themes).toEqual(productionThemes)
})
4 changes: 2 additions & 2 deletions app/lib/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { app, ipcRenderer } from 'electron'
import fs from 'fs'
import path from 'path'
import { memoize } from 'cerebro-tools'
import loadThemes from './loadThemes'
import themes from './themes'

const remote = process.type === 'browser'
? undefined
Expand All @@ -27,7 +27,7 @@ const defaultSettings = memoize(() => {
locale,
lang,
country,
theme: loadThemes()[0].value,
theme: themes[0].value,
hotkey: 'Control+Space',
showInTray: true,
firstStart: true,
Expand Down
19 changes: 0 additions & 19 deletions app/lib/loadThemes.js

This file was deleted.

14 changes: 14 additions & 0 deletions app/lib/themes.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
const prefix = process.env.NODE_ENV === 'development' ? 'http://localhost:3000/' : '../'

const themes = [
{
value: `${prefix}dist/main/css/themes/light.css`,
label: 'Light'
},
{
value: `${prefix}dist/main/css/themes/dark.css`,
label: 'Dark'
}
]

export default themes
Loading