This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import { useCallback, useContext, useEffect, useRef, useState } from 'react'; | |
| import { UserContext } from 'src/contexts/User'; | |
| import { v4 } from '@lukeed/uuid'; | |
| import { NoteEntityType, NoteRes } from 'src/typings/notes'; | |
| import { requestAddNote, requestSaveNote } from 'src/apiServices/notes'; | |
| import { EntityState, useEntityState } from 'src/hooks/useEntityState'; | |
| import debounce from 'lodash.debounce'; | |
| interface EditField { | |
| field: keyof NoteRes; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import { createEvent, createStore, combine, sample, forward } from 'effector'; | |
| import { accessTypes } from 'constants/access-type'; | |
| /** | |
| * | |
| * @type {Event<{title, content, contentText, cb}>} | |
| */ | |
| export const openPopover = createEvent('open Popover'); | |
| export const closePopover = createEvent('close Popover'); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import { createEvent, createStore, forward, guard, sample } from 'effector'; | |
| import nanoid from 'nanoid'; | |
| export const show = createEvent('show Notify'); | |
| export const hide = createEvent('hide Notify'); | |
| /** | |
| * @type {Event<{variant: string, message: string}>} | |
| * @property {string} variant info | success | warning | error | |
| */ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import { | |
| createEffect, | |
| createEvent, | |
| createStore, | |
| sample, | |
| merge, | |
| guard, | |
| forward | |
| } from 'effector'; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import { ky } from './ky.config'; | |
| const employeesUrl = 'employees'; | |
| export async function fetchEmployees() { | |
| return ky.get(employeesUrl).json(); | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import { createEffect, createEvent, createStore, merge } from 'effector'; | |
| import nanoid from 'nanoid'; | |
| import { request, parseObject } from 'jsonrpc-lite'; | |
| const wsURL = `ws://localhost:${process.env.WS_PORT}`; | |
| let socket; | |
| const awaitingMap = new Map(); | |
| function cleanSocket() { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import {useLocalize, addTranslate} from './useLocalize' | |
| addTranslate({ | |
| lang: 'ru', | |
| translates: { | |
| greeting: 'Добро пожаловать, снова' | |
| } | |
| }); | |
| export function App() { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import { useEffect, useRef, useCallback } from 'react'; | |
| import { createEvent, createStore } from 'effector'; | |
| import { useStore } from 'effector-react'; | |
| const open = createEvent('open'); | |
| const closed = createEvent('closed'); | |
| const error = createEvent('error'); | |
| const wsStatus = createStore('closed') |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // На входе массив | |
| var arr = [ | |
| {name: 'width', value: 10}, | |
| {name: 'height', value: 20} | |
| ]; | |
| // На выходе объект {width: 10, height: 20} | |
| const obj = arr.reduce((acc, {name, value}) => acc[name] = value,{}) | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Углифай без транспиляции для современных браузеров | |
| <script type="module" src="bandle.js"> | |
| С транспиляцией и прочим | |
| <script nomodule src="fallback.js"></script> |
NewerOlder