Skip to content

Commit

Permalink
refactor(react-16): migrate to new react version (#604)
Browse files Browse the repository at this point in the history
* 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]>
  • Loading branch information
dubisdev and ogustavo-pereira authored Sep 20, 2022
1 parent c31f0b0 commit 1a1240b
Show file tree
Hide file tree
Showing 25 changed files with 1,720 additions and 1,821 deletions.
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

0 comments on commit 1a1240b

Please sign in to comment.