Skip to content

Commit

Permalink
fix: 🐛 Small bugs
Browse files Browse the repository at this point in the history
  • Loading branch information
solrachix committed Jan 22, 2022
1 parent 385dd50 commit df55238
Show file tree
Hide file tree
Showing 13 changed files with 133 additions and 57,410 deletions.
1 change: 0 additions & 1 deletion .env

This file was deleted.

3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
/node_modules/
/release/
/dist/
/build/
/build/
/.env
57,340 changes: 11 additions & 57,329 deletions dist/app.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/app.js.map

Large diffs are not rendered by default.

5 changes: 2 additions & 3 deletions electron/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import {
nativeImage,
shell
} from 'electron'
import { autoUpdater } from 'electron-updater'
import contextMenu from 'electron-context-menu'
import installExtension, {
REACT_DEVELOPER_TOOLS
Expand All @@ -16,8 +17,6 @@ import * as url from 'url'
import Window from '../src/utils/window'
import { getSystemColorPalette } from './getSystemColorPalette'

import { autoUpdater } from 'electron-updater'

autoUpdater.on('checking-for-update', () => {
sendStatusToWindow('Procurando pr atualizações...')
})
Expand Down Expand Up @@ -47,7 +46,7 @@ let mainWindow: Electron.BrowserWindow // | null
let webContents: Electron.WebContents

function sendStatusToWindow (text) {
// webContents.send('message', text)
webContents.send('message', text)
}

getSystemColorPalette()
Expand Down
47 changes: 39 additions & 8 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,12 +1,21 @@
{
"name": "icons-manager",
"version": "1.0.1",
"version": "1.0.2-snapshot",
"description": "Gerenciador de ícones, feito por Solrachix",
"homepage": "https://github.com/solrachix/icons-manager#readme",
"keywords": [
"icons-manager"
],
"license": "MIT",
"author": "Carlos Miguel <carlos.miguel.oliveira.17@gmail.com>",
"author": "Carlos Miguel <carlos.miguel.oliveira.17@gmail.com> (https://solrachix.app)",
"bugs": {
"url" : "https://github.com/solrachix/icons-manager/issues",
"email" : "carlos.miguel.oliveira.17@gmail.com"
},
"repository": {
"type": "git",
"url": "https://github.com/solrachix/icons-manager.git"
},
"main": "./dist/app.js",
"scripts": {
"build": "rimraf dist && npm-run-all -p build:*",
Expand Down Expand Up @@ -123,25 +132,47 @@
"dist/",
"build/"
],
"icon": "",
"icon": "dist/renderer/icon.ico",
"mac": {
"category": "public.app-category.utilities"
"category": "public.app-category.utilities",
"publish": [
"github"
]
},
"linux": {
"target": [
"AppImage"
],
"category": "Network"
"category": "Utility",
"publish": [
"github"
]
},
"win": {
"asar": false,
"target": "nsis",
"target": [
{
"target": "nsis",
"arch": [
"x64",
"ia32"
]
}
],
"icon": "dist/renderer/icon.ico",
"publish": [
"github",
"bitbucket"
"github"
]
},
"publish": [
{
"provider": "github",
"owner": "solrachix",
"repo": "icons-manager",
"releaseType": "draft",
"private": false
}
],
"nsis": {
"installerIcon": "dist/renderer/icon.ico",
"installerHeaderIcon": "dist/renderer/icon.ico",
Expand Down
6 changes: 5 additions & 1 deletion src/components/ContextMenu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,11 @@ function ContextMenu ({ iconLibSelected }: Props, ref: any) {
{iconLibSelected?.projectUrl && (
<>
<Separator />
<Item onClick={() => shell.openExternal(iconLibSelected?.projectUrl)}>
<Item
onClick={() =>
shell.openExternal(String(iconLibSelected?.projectUrl))
}
>
Ir para o site
</Item>
</>
Expand Down
2 changes: 1 addition & 1 deletion src/components/PickerColor/styles.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@ import styled from 'styled-components'

export const Container = styled.div`
width: 12%;
margin-left: 1rem;
button {
width: 100%;
padding: 0.2rem 0.8rem;
margin-left: 1rem;
border: 1px solid ${(props) => props.theme.colors.background.darker};
background: transparent;
Expand Down
36 changes: 17 additions & 19 deletions src/components/Toast/index.tsx
Original file line number Diff line number Diff line change
@@ -1,24 +1,19 @@
import React, { useEffect, useCallback } from 'react'
import {
FiAlertCircle,
FiCheckCircle,
FiInfo,
FiXCircle
} from 'react-icons/fi'
import React, { useEffect, useCallback, useState } from 'react'
import { FiAlertCircle, FiCheckCircle, FiInfo, FiXCircle } from 'react-icons/fi'
import { useWindow } from '../../context/window'

import { Container } from './styles'

export interface ToastMessage {
id: string;
type: 'success' | 'error' | 'info';
title: string;
description?: string;
id: string
type: 'success' | 'error' | 'info'
title: string
description?: string
}

interface ToastProps {
toast: ToastMessage;
style: any;
toast: ToastMessage
style: any
}

const icons = {
Expand All @@ -29,27 +24,30 @@ const icons = {

const Toast: React.FC<ToastProps> = ({ toast, style }) => {
const { removeToast } = useWindow().Toast
const [time, setTime] = useState(4000)

const closeToast = useCallback(() => removeToast(toast.id), [
removeToast,
toast.id
])
const closeToast = useCallback(
() => removeToast(toast.id),
[removeToast, toast.id]
)

useEffect(() => {
const timer = setTimeout(() => {
closeToast()
}, 4000)
}, time)

return (): void => {
clearTimeout(timer)
}
}, [closeToast])
}, [closeToast, time])

return (
<Container
type={toast.type}
hasDescription={!!toast.description}
style={style}
onMouseMove={() => setTime(100000)}
onMouseLeave={() => setTime(2000)}
>
{icons[toast.type]}

Expand Down
16 changes: 9 additions & 7 deletions src/components/Toast/styles.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,20 +25,22 @@ export const Container = styled(animated.div)<ContainerProps>`
}
return css`
position: relative;
width: 320px;
padding: 1rem 1.8rem 1rem 1rem;
margin: 0 1.5rem 0.5rem 0;
position: relative;
padding: 16px 30px 16px 16px;
margin: 0 24px 8px 0;
border-radius: 4px;
box-shadow: 2px 2px 8px rgba(0, 0, 0, 0.2);
box-shadow: 2px 2px 0.5rem rgba(0, 0, 0, 0.2);
backdrop-filter: blur(0.4rem);
display: flex;
${toastTypes[props.type]}
&:first-child {
margin-top: 24px;
margin-top: 2.5rem;
}
svg {
Expand All @@ -63,8 +65,8 @@ export const Container = styled(animated.div)<ContainerProps>`
button {
position: absolute;
right: 8px;
top: 18px;
right: 0.5rem;
top: 1.2rem;
opacity: 0.6;
border: 0;
background: transparent;
Expand Down
11 changes: 9 additions & 2 deletions src/context/updater.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import * as Electron from 'electron'

import React, { createContext, useState, useEffect } from 'react'
import React, { createContext, useEffect } from 'react'
import { useWindow } from './window'

interface UpdaterProviderProps {
children: React.ReactNode
Expand All @@ -11,9 +12,15 @@ const UpdaterContext = createContext(null)
export function UpdaterProvider ({
children
}: UpdaterProviderProps): React.ReactElement {
const { Toast } = useWindow()

useEffect(() => {
Electron.ipcRenderer.on('message', (event, text) => {
console.log(text)
Toast.addToast({
type: 'info',
title: 'Atualização',
description: text
})
})
}, [])

Expand Down
Loading

0 comments on commit df55238

Please sign in to comment.