Skip to content

Commit 1a1240b

Browse files
refactor(react-16): migrate to new react version (#604)
* chore: refactor to functional components * chore: update react-markdown * chore: move to useState and remove preload component * chore(settings-plugin): refactor to functional component * chore: refactor ResultsList component * fix: running action typo * chore: update deps * chore: add CSP * chore: refactor Cerebro to functional component * refactor: migrate settings to funtional component * refactor: migrate main input to react 16 * fix: remove div not needed * fix: remove valores dentro do array * refactor: remove main component * fix: on change not parse value * chore: add readonly to remove warning * chore: refactor themes file * fix: react-select value as object * fix: unsuscribe error in functional component * fix: react-virtualized error * fix: settings refactor * docs: update docs Co-authored-by: oguhpereira <[email protected]>
1 parent c31f0b0 commit 1a1240b

File tree

25 files changed

+1720
-1821
lines changed

25 files changed

+1720
-1821
lines changed

app/background/index.html

+1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
<html>
33
<head>
44
<meta charset="utf-8">
5+
<meta http-equiv="Content-Security-Policy" content="script-src * 'unsafe-inline';"/>
56
<script>
67
(function() {
78
const script = document.createElement('script');

app/lib/__tests__/loadThemes.spec.js

+2-18
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import themesLoader from '../loadThemes'
1+
import themes from '../themes'
22

33
const productionThemes = [
44
{
@@ -11,22 +11,6 @@ const productionThemes = [
1111
}
1212
]
1313

14-
const developmentThemes = [
15-
{
16-
value: 'http://localhost:3000/dist/main/css/themes/light.css',
17-
label: 'Light'
18-
},
19-
{
20-
value: 'http://localhost:3000/dist/main/css/themes/dark.css',
21-
label: 'Dark'
22-
}
23-
]
24-
2514
test('returns themes for production', () => {
26-
expect(themesLoader()).toEqual(productionThemes)
27-
})
28-
29-
test('returns themes for development', () => {
30-
process.env.NODE_ENV = 'development'
31-
expect(themesLoader()).toEqual(developmentThemes)
15+
expect(themes).toEqual(productionThemes)
3216
})

app/lib/config.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { app, ipcRenderer } from 'electron'
22
import fs from 'fs'
33
import path from 'path'
44
import { memoize } from 'cerebro-tools'
5-
import loadThemes from './loadThemes'
5+
import themes from './themes'
66

77
const remote = process.type === 'browser'
88
? undefined
@@ -27,7 +27,7 @@ const defaultSettings = memoize(() => {
2727
locale,
2828
lang,
2929
country,
30-
theme: loadThemes()[0].value,
30+
theme: themes[0].value,
3131
hotkey: 'Control+Space',
3232
showInTray: true,
3333
firstStart: true,

app/lib/loadThemes.js

-19
This file was deleted.

app/lib/themes.js

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
const prefix = process.env.NODE_ENV === 'development' ? 'http://localhost:3000/' : '../'
2+
3+
const themes = [
4+
{
5+
value: `${prefix}dist/main/css/themes/light.css`,
6+
label: 'Light'
7+
},
8+
{
9+
value: `${prefix}dist/main/css/themes/dark.css`,
10+
label: 'Dark'
11+
}
12+
]
13+
14+
export default themes

0 commit comments

Comments
 (0)