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 Compressor from "compressorjs"; | |
| export const compressImage = async ( | |
| file: File, | |
| quality: number, | |
| maxHeight: number, | |
| maxWidth: number, | |
| convertSize?: number | |
| ): Promise<File | Blob> => { | |
| return await new Promise((resolve, reject) => { |
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 React, { useEffect, useState } from "react"; | |
| import { dynamicTimeLeft } from "utils/date"; | |
| interface TimerProps { | |
| dateEnd: Date; | |
| } | |
| const Timer: React.FC<TimerProps> = ({ dateEnd }) => { | |
| const [time, setTime] = useState<null | string>(null); |
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
| export const dynamicTimeLeft = (date1: Date, date2: Date) => { | |
| const distance = date2.getTime() - date1.getTime(); | |
| const hours = Math.floor( | |
| (distance % (1000 * 60 * 60 * 24)) / (1000 * 60 * 60) | |
| ); | |
| const minutes = Math.floor((distance % (1000 * 60 * 60)) / (1000 * 60)); | |
| const seconds = Math.floor((distance % (1000 * 60)) / 1000); | |
| const addZero = (t: number) => (t > 9 ? t : `0${t}`); |
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 { create } from "ipfs-http-client"; | |
| import { ImportCandidate } from "ipfs-core-types/src/utils"; | |
| const client = create({ url: "https://ipfs.infura.io:5001/api/v0" }); | |
| const useIpfs = () => { | |
| const upload = async (file: ImportCandidate) => { | |
| try { | |
| const added = await client.add(file); | |
| const url = `https://ipfs.infura.io/ipfs/${added.path}`; |
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
| const SelectDisplayImage = () => { | |
| const [image, setImage] = useState<null | string>(null); | |
| const onImageChange = (event: React.ChangeEvent<HTMLInputElement>) => { | |
| const input = event.target; | |
| if (!input.files?.length) { | |
| return; | |
| } |
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 useSWR from "swr"; | |
| import { fetcher } from "lib/fetch"; | |
| const usePrice = (fromCurrencies: string, vsCurrencies: string) => { | |
| const { data, error } = useSWR( | |
| `https://api.coingecko.com/api/v3/simple/price?ids=${fromCurrencies}&vs_currencies=${vsCurrencies}`, | |
| fetcher | |
| ); | |
| return { |
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
| interface ProgressProps { | |
| label?: string; | |
| value: number; | |
| } | |
| const Progress: React.FC<ProgressProps> = ({ label, value }) => { | |
| return ( | |
| <> | |
| {label ? ( | |
| <div className="mb-1 flex justify-between"> |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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 { useState, Fragment } from "react"; | |
| import { Transition } from "@headlessui/react"; | |
| import * as DialogPrimitive from "@radix-ui/react-dialog"; | |
| import * as Portal from "@radix-ui/react-portal"; | |
| interface DialogProps { | |
| trigger: React.ReactNode; | |
| } | |
| const Dialog: React.FC<DialogProps> = ({ trigger }) => { |
NewerOlder