diff --git a/src/main/index.ts b/src/main/index.ts index 630503e..cc028c5 100644 --- a/src/main/index.ts +++ b/src/main/index.ts @@ -13,7 +13,6 @@ import { app, globalShortcut, ipcMain, BrowserWindow } from 'electron' import { okk } from '../helpers/helpers' import { pushTask } from '../tasks/push' -import { startServer } from '../plugins/server' // import { setContextMenu } from '../plugins/tray' import { createAppWindow, createSelectWindow } from '../plugins/windows' import { @@ -49,11 +48,12 @@ app.on('ready', () => { selectWindow = createSelectWindow() // setContextMenu() - try { - startServer() - } catch (error) { - logger.error('startServer failed!', error) - } + // todo: enable with port + // try { + // startServer() + // } catch (error) { + // logger.error('startServer failed!', error) + // } try { registerShortcuts() diff --git a/src/plugins/server.ts b/src/plugins/server.ts index 7dabd98..0a5960e 100644 --- a/src/plugins/server.ts +++ b/src/plugins/server.ts @@ -117,9 +117,9 @@ const startServer = () => { }) const state = store.getState() - app.listen(okk(state.settings.port), () => - logger.log(` server listening on port ${state.settings.port}!`), - ) + // app.listen(okk(state.settings.port), () => + // logger.log(` server listening on port ${state.settings.port}!`), + // ) } export { startServer } diff --git a/src/plugins/settings.ts b/src/plugins/settings.ts index 3bfb54d..1dbe9b8 100644 --- a/src/plugins/settings.ts +++ b/src/plugins/settings.ts @@ -3,13 +3,13 @@ import { ISettingsState, IRepoSetting } from '../store/settings/types' const INITIAL_SETTINGS: ISettingsState = { reposList: [], - port: 3456, + // port: 3456, githubAuth: '', githubUserName: '', jiraHost: '', jiraEmail: '', jiraAuth: '', - jiraJQL: '', + jiraJQL: 'assignee in (currentUser())', } const validateSettings = (settings: ISettingsState) => { @@ -20,7 +20,7 @@ const validateSettings = (settings: ISettingsState) => { settings.jiraEmail && settings.jiraHost && settings.jiraJQL && - settings.port && + // settings.port && settings.reposList.length && settings.reposList.reduce( (prev, current: IRepoSetting) => diff --git a/src/store/branches/actions.ts b/src/store/branches/actions.ts index dd7e14e..f36eced 100644 --- a/src/store/branches/actions.ts +++ b/src/store/branches/actions.ts @@ -23,7 +23,7 @@ export const fetchBranches = (): ThunkAction< let newBranches: TBranches = [] for (const repo of state.settings.reposList) { - if (!repo.shouldMonitor) { + if (!repo.enableAutoRefresh) { continue } diff --git a/src/store/settings/reducers.ts b/src/store/settings/reducers.ts index f5b556a..57e4c53 100644 --- a/src/store/settings/reducers.ts +++ b/src/store/settings/reducers.ts @@ -1,9 +1,7 @@ import { settingsStore } from '../../plugins/settings' import { SAVE_SETTINGS, ISettingsState, TSettingsActionTypes } from './types' -// @ts-ignore -import electronTimber from 'electron-timber' - -const logger = electronTimber.create({ name: 'reducers' }) +// import electronTimber from 'electron-timber' +// const logger = electronTimber.create({ name: 'reducers' }) const initialState: ISettingsState = settingsStore.getAll() diff --git a/src/store/settings/types.ts b/src/store/settings/types.ts index 19aac0f..e9f0233 100644 --- a/src/store/settings/types.ts +++ b/src/store/settings/types.ts @@ -5,12 +5,12 @@ export interface IRepoSetting { remoteName: string repoId: string orgID: string - shouldMonitor: boolean + enableAutoRefresh: boolean } export interface ISettingsState { reposList: Array - port: number + // port: number githubAuth: string githubUserName: string jiraHost: string diff --git a/src/store/tickets/actions.ts b/src/store/tickets/actions.ts index c3ba839..f891aaa 100644 --- a/src/store/tickets/actions.ts +++ b/src/store/tickets/actions.ts @@ -104,7 +104,7 @@ export const fetchPRs = ( try { for (const repo of state.settings.reposList) { - if (repo.shouldMonitor) { + if (repo.enableAutoRefresh) { const pulls = await getMyExtendedPRs(repo.repoId) allPRs = [...allPRs, ...pulls] } diff --git a/src/windows/components/styles.tsx b/src/windows/components/styles.tsx index bbfc6eb..9013795 100644 --- a/src/windows/components/styles.tsx +++ b/src/windows/components/styles.tsx @@ -40,4 +40,34 @@ const Error = styled.span` color: red; ` -export { BadgeStyle, ClickableBadgeStyle, TextFieldWrapper, Error } +const textColor = '#cacaca' +const settingLinkColor = '#8bc34a' + +const Label = styled.label` + font-size: 13px; + margin-bottom: 2px; + color: ${textColor}; +` + +const SupportLink = styled.span` + margin-left: 10px; + display: inline; + cursor: pointer; + font-size: 13px; + color: ${settingLinkColor}; + + :hover { + color: white; + } +` + +export { + BadgeStyle, + ClickableBadgeStyle, + TextFieldWrapper, + Error, + Label, + SupportLink, + textColor, + settingLinkColor, +} diff --git a/src/windows/index.css b/src/windows/index.css index c57cebe..1e9c382 100644 --- a/src/windows/index.css +++ b/src/windows/index.css @@ -3,12 +3,9 @@ } html { - background-color: #343648; + background-color: #181921; } body { - font-family: 'Helvetica Neue'; - margin: 0; - max-width: 100vw; - padding: 0px; + font-family: monospace; } diff --git a/src/windows/modals/Settings.tsx b/src/windows/modals/Settings.tsx index 391277f..0f45cc7 100644 --- a/src/windows/modals/Settings.tsx +++ b/src/windows/modals/Settings.tsx @@ -13,7 +13,13 @@ import css from '@emotion/css' import { shell } from 'electron' import { folderPicker } from '../../plugins/dialogs' import { getRepoFromPath, getRemote } from '../../plugins/git' -import { TextFieldWrapper, Error } from '../components/styles' +import { + TextFieldWrapper, + Error, + Label, + SupportLink, + textColor, +} from '../components/styles' const mapState = (state: TAppState) => ({ settings: state.settings, @@ -37,9 +43,8 @@ const settings: React.FC = ({ settings, saveSettingsAction }) => ( @@ -55,9 +60,9 @@ const settings: React.FC = ({ settings, saveSettingsAction }) => ( }} validate={values => { const errors: any = {} - if (!values.port) { - errors.port = 'Required' - } + // if (!values.port) { + // errors.port = 'Required' + // } if (!values.githubAuth) { errors.githubAuth = 'Required' } @@ -97,20 +102,32 @@ const settings: React.FC = ({ settings, saveSettingsAction }) => ( return errors }} render={({ handleSubmit, pristine, invalid, form }) => ( -
-

Settings:

- - + +

+ Settings: +

+ {({ input, meta }) => ( - + {meta.error && meta.touched && {meta.error}} @@ -118,91 +135,135 @@ const settings: React.FC = ({ settings, saveSettingsAction }) => ( )} - - {({ input, meta }) => ( - - - - - {meta.error && meta.touched && {meta.error}} - - )} - - {({ input, meta }) => ( - - - - shell.openExternal('https://github.com/settings/tokens') - } - > - https://github.com/settings/tokens - + + + {meta.error && meta.touched && {meta.error}} )} - {({ input, meta }) => ( - - + + {meta.error && meta.touched && {meta.error}} )} - {({ input, meta }) => ( - - + + {meta.error && meta.touched && {meta.error}} )} - + {({ input, meta }) => ( - - + + {meta.error && meta.touched && {meta.error}} )} - + {({ input, meta }) => ( - - + + - - shell.openExternal( - 'https://id.atlassian.com/manage/api-tokens', - ) - } - > - https://id.atlassian.com/manage/api-tokens - {meta.error && meta.touched && {meta.error}} )} -

- Repos +

+ repos: -

+ + {({ fields }) => fields.map((fieldKey, index) => (
- fields.remove(index)} css={css` - width: 400px; + cursor: pointer; + position: absolute; + right: 0; + top: 0; `} - /> -
+ > + ❌ + + + {({ input, meta }) => ( + + + - -
+ {meta.error && meta.touched && ( + {meta.error} + )} +
+ )} +
- -
- -
+ + {({ input, meta }) => ( + + + - + {meta.error && meta.touched && ( + {meta.error} + )} + + )} + - + + {({ input, meta }) => ( + + + - fields.remove(index)} - style={{ cursor: 'pointer' }} - > - ❌ - + {meta.error && meta.touched && ( + {meta.error} + )} + + )} + + + + {({ input, meta }) => ( + + + + + {meta.error && meta.touched && ( + {meta.error} + )} + + )} + + + + {({ input }) => { + console.log(input.value, input.checked) + + return ( +
+ + +
+ ) + }} +
)) }
-