Skip to content

Commit

Permalink
Update icons
Browse files Browse the repository at this point in the history
  • Loading branch information
semreg committed May 28, 2019
1 parent c6535b1 commit 8962023
Show file tree
Hide file tree
Showing 73 changed files with 9,704 additions and 245 deletions.
6 changes: 5 additions & 1 deletion pwa/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,15 @@
"mdbreact": "^4.12.0",
"node-sass": "^4.11.0",
"react": "^16.8.6",
"react-alert": "^5.5.0",
"react-alert-template-basic": "^1.0.0",
"react-alert-template-oldschool-dark": "^1.0.1",
"react-dom": "^16.8.6",
"react-hot-loader": "^4.8.4",
"react-router-dom": "^4.3.1",
"react-scripts": "2.1.8",
"react-spring": "^9.0.0-beta.1"
"react-spring": "^9.0.0-beta.1",
"react-transition-group": "^4.0.1"
},
"scripts": {
"start": "react-scripts start",
Expand Down
25 changes: 18 additions & 7 deletions pwa/src/components/App.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,27 @@ import Layout from './layout/Layout'
import { BrowserRouter as Router } from 'react-router-dom'
import Main from './main/Main'
import GlobalState from '../context/GlobalState'
import { transitions, positions, Provider as AlertProvider } from 'react-alert'
import AlertTemplate from '../javascripts/alert-template'

function App (props) {
const options = {
position: positions.BOTTOM_CENTER,
timeout: 2000,
offset: '30px',
transition: transitions.SCALE
}

return (
<GlobalState>
<Router>
<Layout>
<Main />
</Layout>
</Router>
</GlobalState>
<AlertProvider template={AlertTemplate} {...options}>
<GlobalState>
<Router>
<Layout>
<Main />
</Layout>
</Router>
</GlobalState>
</AlertProvider>
)
}

Expand Down
24 changes: 20 additions & 4 deletions pwa/src/components/main/сoordinator-form/CoordinatePicker.jsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import React, { useState, useRef, useEffect, useContext } from 'react'
import { element, object } from 'prop-types'
import { MDBBtn, MDBContainer, MDBRow, MDBCol, MDBInput } from 'mdbreact'
import { useAlert } from 'react-alert'
import ImageCanvas from './ImageCanvas'
import getRadius from '../../../javascripts/getRadius'
import Animated from '../../other/Animated'
Expand Down Expand Up @@ -33,6 +34,8 @@ function CoordinatePicker ({ children, image, imageProps }) {

const context = useContext(localeContext)

const alert = useAlert()

useEffect(() => {
setformContainerProps({
width: formContainer.current.clientWidth,
Expand All @@ -50,7 +53,7 @@ function CoordinatePicker ({ children, image, imageProps }) {
`${
coords
.map(xy => getNaturalCoords(xy, canvasProps, imageProps))
.join(',')
.join(', ')
}`
)
: ''
Expand Down Expand Up @@ -94,6 +97,10 @@ function CoordinatePicker ({ children, image, imageProps }) {
setCoordsHistory(currentCoordsHistory)
setCoords(coordsHistory.slice(0, -1).pop())
setRemovedCoords([...removedCoords, coords])
} else {
setCoordsHistory([])
setRemovedCoords([...removedCoords, coords])
setCoords([])
}
}
}
Expand Down Expand Up @@ -125,9 +132,15 @@ function CoordinatePicker ({ children, image, imageProps }) {
]
)

const { title, note, lastCoords, allCoords } = context.content.contents.main.coordinatePickerForm
const { title, note, lastCoords, allCoords, copyMsg } = context.content.contents.main.coordinatePickerForm
const { undo: undoBtnCap, redo: redoBtnCap, clear } = context.content.contents.main.buttons

const copyCoords = e => {
e.target.select()
document.execCommand('copy')
alert.success(copyMsg)
}

return (
<Animated>
<MDBContainer className='mt-3 form-container text-center'>
Expand Down Expand Up @@ -173,6 +186,8 @@ function CoordinatePicker ({ children, image, imageProps }) {
error="wrong"
success="right"
value={`${currentCoords ? `${getNaturalCoords(currentCoords, canvasProps, imageProps)}` : ''}`}
onClick={copyCoords}
className='pointer'
/>
)
: ''
Expand All @@ -185,14 +200,15 @@ function CoordinatePicker ({ children, image, imageProps }) {
validate
error="wrong"
success="right"
className='text'
className='text pointer'
value={coordsToDisplay}
onClick={copyCoords}
/>
</div>
<div className="control-buttons">
<MDBBtn
onClick={undo}
className={`uppercase ${(coords.length < 1 || (imageProps.selectionShape !== 'poly' && coordsHistory.length < 2)) ? 'disabled' : ''}`}
className={`uppercase ${(coords.length < 1 || (imageProps.selectionShape !== 'poly' && coordsHistory.length < 1)) ? 'disabled' : ''}`}
>
<i className="fas fa-undo"></i> {undoBtnCap}
</MDBBtn>
Expand Down
2 changes: 2 additions & 0 deletions pwa/src/components/main/сoordinator-form/ImageCanvas.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -76,9 +76,11 @@ function ImageCanvas ({
? (
<Poly
coords={coords}
coordsHistory={coordsHistory}
imageToDraw={imageToDraw}
canvasProps={canvasProps}
setCoords={setCoords}
setCoordsHistory={setCoordsHistory}
setCurrentCoords={setCurrentCoords}
/>
)
Expand Down
13 changes: 13 additions & 0 deletions pwa/src/components/main/сoordinator-form/coordinator-form.scss
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,15 @@
display: inline-block;
text-align: center;
}

.checkboxgroup:hover {
cursor: pointer;

label {
cursor: pointer;
}
}

.checkboxgroup label {
display: block;
}
Expand Down Expand Up @@ -69,4 +78,8 @@ canvas:hover {

.uppercase {
text-transform: uppercase
}

.pointer:hover {
cursor: pointer;
}
119 changes: 119 additions & 0 deletions pwa/src/javascripts/alert-template.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,119 @@
'use strict'

function _interopDefault (ex) { return (ex && (typeof ex === 'object') && 'default' in ex) ? ex['default'] : ex }

var React = _interopDefault(require('react'))

var _extends = Object.assign || function (target) {
for (var i = 1; i < arguments.length; i++) {
var source = arguments[i]

for (var key in source) {
if (Object.prototype.hasOwnProperty.call(source, key)) {
target[key] = source[key]
}
}
}

return target
}

var alertStyle = {
backgroundColor: '#333333',
color: 'white',
borderRadius: '2px',
display: 'flex',
justifyContent: 'space-between',
alignItems: 'center',
boxShadow: '0 8px 12px 0 rgba(0,0,0,0.3)',
width: '300px',
boxSizing: 'border-box',
fontSize: '15px',
position: 'relative'
}

var contentWrapperStyle = {
padding: '10px 60px 10px 10px',
display: 'flex',
width: '100%',
justifyContent: 'center',
alignItems: 'center'
}

var iconPlaceholderStyle = {
display: 'flex',
justifyContent: 'center',
width: '50px'
}

var messageStyle = {
flex: 3,
textAlign: 'center',
textTransform: 'uppercase',
width: '100%'
}

var closeButtonStyle = {
minWidth: '50px',
height: '100%',
position: 'absolute',
borderRadius: '0 2px 2px 0',
cursor: 'pointer',
top: 0,
right: 0,
backgroundColor: '#444',
display: 'flex',
justifyContent: 'center',
alignItems: 'center'
}

var getIcon = function getIcon (type) {
switch (type) {
case 'error':
return 'url(\'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAB8AAAAgCAYAAADqgqNBAAAACXBIWXMAAA7EAAAOxAGVKw4bAAAEKklEQVRIiZ2WzW5TRxTHf2dMEtckbYwi0tIgpVI3SJFYVO4uq+67ZUeRuuIVeAsCyBKlUrup2PIEfQCQWNBFpGYBsnBTtZZdnMSkxHO6mI87M/dahE40yvjcmfP/n88Z4f8PWbBuGtq0zg4dffP1NvArsH1uTRpkiu58xb/Xrn9/+fbtn98HDKgp9N76UGCNf24stVo//vHgwS2cYQIYKiMzY0vwc48KmGwCtJeWHg3v3/8uAQ4zJSAfBB6Uq+Zyq26m4o+Wlx+9vnfvZgGeETg3eGmhRbGQTMUuLWVnOisrPwz29hZ54P3gqTujTN20CtZW7kdBVdHENavt9sPB3t7NBgKL3Z6CBrA4UayHtKgjYuFs/zfs8dSfqUisttsPX929+y1Fwl1oAk0tdDK3sAWxMgRy/A+nT35BREBBBARBgAtqrwNPPAGtgduEWla/KVhweQBO1pGY1YSAAhKIB2ABtGZ5dHMKqqml6sHUW+0hNQLgcNXrMsiC/peCyyJgG4C8eVar71WJqTdJEZXoQo2G5vaV4FiLGKEGHADs2ifYy1uwvhHPGMCO/8b+OYDpBFXBCpiEgLMqEohpFcCTL9oArMy3vkQ3txrdZ7obmO4G88MBdnDglPlYB5cbicAx4dJSE4uNtDLgz7YjcOvSpRp4kLU+vUrryhdOv4pv7DGFU8sVf7FkASkTzC630SvbAHR6PTbv3KHT68X9pcx8vg0rK67MgtsFjHNFmAL1UpNWRkBdjP24uLsLwPqNG1EW1hd3dzl5+tSBbV5FB7876yWzLq3IenvNsl2Bzmr8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HwWHXxSA3gU/XCxFwJDcyNAbbpiKh+bfv0DxJXWt7fKj70iwkXxtwaoJiGwAc74V5Zxf28RHUMD0sNvEQRUPFuN37r9L9NeSElzoywyUj5OfBkqiKKm5A6BFInIRWbYCbeohT8xOwdjDKfiMTzyR1jqqoQW+JCM+M/oQ0MxVFidYQAAAAASUVORK5CYII=\') no-repeat'
}
}

var AlertTemplate = function AlertTemplate (_ref) {
var message = _ref.message
var options = _ref.options
var style = _ref.style
var close = _ref.close
return React.createElement(
'div',
{ style: _extends({}, alertStyle, style) },
React.createElement(
'div',
{ style: contentWrapperStyle },
React.createElement(
'div',
{ style: iconPlaceholderStyle },
React.createElement('div', { style: { width: 32, height: 32, background: getIcon(options.type) } })
),
React.createElement(
'div',
{ style: messageStyle },
message
)
),
React.createElement(
'div',
{
onClick: close,
style: closeButtonStyle
},
React.createElement(
'svg',
{ fill: 'white', xmlns: 'http://www.w3.org/2000/svg', height: '25', width: '25', viewBox: '0 0 48 48' },
React.createElement('path', { d: 'M38 12.83l-2.83-2.83-11.17 11.17-11.17-11.17-2.83 2.83 11.17 11.17-11.17 11.17 2.83 2.83 11.17-11.17 11.17 11.17 2.83-2.83-11.17-11.17z' }),
React.createElement('path', { d: 'M0 0h48v48h-48z', fill: 'none' })
)
)
)
}

module.exports = AlertTemplate
5 changes: 3 additions & 2 deletions pwa/src/static/locale/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
"title": "Specify Properties",
"imageSizeBlock": {
"title": "Image Size",
"note": "Do not change if you want to save the natural size",
"note": "Do not change if you want to keep the original proportions",
"width": "Width (px)",
"height": "Heigth (px)"
},
Expand All @@ -33,7 +33,8 @@
"title": "Coords",
"note": "Automatically calculated for specified resolution",
"lastCoords": "Last Coords",
"allCoords": "All Coords"
"allCoords": "All Coords",
"copyMsg": "Copied"
},
"buttons": {
"goNext": "Go Next",
Expand Down
17 changes: 9 additions & 8 deletions pwa/src/static/locale/ru.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,42 +3,43 @@
"short": "ru",
"contents": {
"nav": {
"issues": "Приобщиться",
"issues": "Нашли баг?",
"sourceCode": "Исходный код"
},
"main": {
"uploadForm": {
"title": "Загрузите изображение",
"note": "Изображение должно иметь корректный размер и разрешение.",
"note": "Изображение должно иметь корректный размер и расширение.",
"uploadInput": {
"areaCap": "Перетащите и бросьте или кликните",
"areaCap": "Перетащите и бросьте сюда или кликните",
"removeBtnCap": "Удалить"
}
},
"propsForm": {
"title": "Укажите Свойства",
"imageSizeBlock": {
"title": "Размер Изображения",
"note": "Не изменяйте, если хотите сохранить оригинальный размер",
"note": "Не изменяйте, если хотите сохранить оригинальные пропорции",
"width": "Ширина (пикс)",
"height": "Висота (пикс)"
},
"selectionAreaShapeBlock": {
"title": "Форма области виделения",
"note": "Виберете один из троих вариантов"
"note": "Виберете один из трех вариантов"
}
},
"coordinatePickerForm": {
"title": "Координаты",
"note": "Автоматически вычеслены для указаного размера",
"lastCoords": "Последние координаты",
"allCoords": "Все координаты"
"allCoords": "Все координаты",
"copyMsg": "Скопировано"
},
"buttons": {
"goNext": "Начнём",
"next": "Дальше",
"next": "Далее",
"cancel": "Отмена",
"edit": "Сменить",
"edit": "Редактировать",
"undo": "Назад",
"redo": "Вперёд",
"clear": "Очистить"
Expand Down
Loading

0 comments on commit 8962023

Please sign in to comment.