- Components
- Development Environment
- Deployment
- General rules 4.1 Hooks 4.2 Project structure
This file contains 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
# Uses | |
## Editor | |
- [Visual Studio Code](https://code.visualstudio.com/download) (settings [here](https://gist.github.com/diurivj/ca5222271a32336273ac1c5a168e8166)) | |
- [lucy](https://marketplace.visualstudio.com/items?itemName=juliettepretot.lucy-vscode) editor theme by [juliettepretot](https://marketplace.visualstudio.com/publishers/juliettepretot) | |
- [Dank Mono](https://dank.sh/) font by [Phil Plückthun](https://twitter.com/_philpl) | |
## Chrome Extensions | |
- [JSON Viewer](https://chrome.google.com/webstore/detail/json-viewer/gbmdgpbipfallnflgajpaliibnhdgobh) | |
- [React Developer Tools](https://chrome.google.com/webstore/detail/react-developer-tools/fmkadmapgofadopljbjfkapdkoienihi) |
This file contains 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
const d = new Date() | |
const currentYear = d.getFullYear() | |
const months = Array(12).fill().map((e,i) => i) | |
// console.debug('currentYear', currentYear) | |
// console.debug(months) | |
const getDaysInMonth = (month, year) => (new Array(31)).fill('').map((v,i)=>new Date(year,month-1,i+1)).filter(v=>v.getMonth()===month-1) | |
console.debug(getDaysInMonth(1, currentYear)) |
This file contains 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
/* eslint-disable react/prop-types */ | |
/* eslint-disable no-unused-vars */ | |
/* eslint-disable no-console */ | |
import React, { useState, useEffect } from 'react' | |
import { api } from '../api' | |
import { useServerData } from '../state/serverDataContext' | |
import Cover from './Cover' | |
import Header from './Header' | |
import styles from '../styles/root/Root.module.scss' |
This file contains 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 { useState, useCallback } from 'react' | |
import { useStore } from 'react-redux' | |
export const useStructure = param => { | |
const store = useStore() | |
const fetchedStructure = store.getState().fetchStructure.structure | |
return { | |
structure, | |
setStructure, | |
getParentTagList: useCallback(tagId => setStructure( |
This file contains 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
/** | |
* @param {number} tagId the id of the tags we are looking for it's child | |
* @param {Array} tags array of the level we are looking for the child tags | |
* @returns {object} object of the found child object | |
*/ | |
function findTagById(tagId, tags) { | |
// console.debug("findTagById > Tags", tags); | |
const result = filter(tags, { item: [{ tag_id: tagId }] }); | |
// console.debug("findTagById > result", result); | |
return result[0].item.filter(t => t.tag_id === tagId)[0]; |
This file contains 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
const PiCamera = require('pi-camera'); | |
function getRandomInt(max) { | |
return Math.floor(Math.random() * Math.floor(max)); | |
} | |
setInterval(function() { | |
var path = './' + getRandomInt(500) + '.jpg'; |
This file contains 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
version: '2' | |
services: | |
web: | |
image: nginx:latest | |
ports: | |
- "80:80" | |
volumes: | |
- ./<path-to-folder/backend>:/code/Backend | |
- ./<path-to-folde/frontend>:/code/Frontend |
This file contains 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
// some stuff here | |
export type FontSouce = Parameters<typeof Font.loadAsync>[0]; | |
const usePromiseAll = ( | |
promises: Promise<void | void[] | Asset[]>[], | |
cb: () => void | |
) => | |
useEffect(() => { | |
(async () => { | |
await Promise.all(promises); | |
cb(); |