import { useEffect, useState } from 'react';

import { ChooseArt } from '@/pages/ChooseArt';
import { Paint } from '@/pages/Paint';

import { gridFromAscii } from '@/utils/grid';

const butterfly = `|                      |
|  ⠀⠀⠀⠀⊹               |
|  ⢶⢻⣑⣒⢤⡀⠀⢄⠀⠀⡠⠀⢀⡤⣆⣊⡿⡷  |
|  ⠀⠹⠹⣚⣣⠻⣦⡀⠀⠀⢀⣴⠟⣸⢓⢎⠏⠀  |
|  ⠀⠀⢡⣱⣖⣢⡾⢿⣾⣷⡿⢷⣖⣒⣎⡎⠀⠀  |
|  ⠀⠀⠀⣠⠓⢬⠅⡺⢻⡟⢗⠨⡥⠚⣄⠀⠀⠀  |
|  ⠀⠀⠀⣿⡆⠘⠆⢇⢸⡇⠸⠰⠃⢰⣿⠀⠀⠀  |
|  ⠀⠀⠀⠐⡻⣮⣬⠞⠈⠁⠳⣤⣴⢿⠂⠀⠀⠀  |
|  ⠀⠀⠀⡜⠀⠁⠉⠀⠀⠀⠀⠈⠈⠀⢣⠀⠀⠀  |
|  ⊹                   |
|                      |`;

export const App: React.FC = () => {
    // const [chosenArt, setChosenArt] = useState<undefined | string>(undefined);
    const [chosenArt, setChosenArt] = useState<undefined | string>(butterfly);

    if (chosenArt !== undefined) {
        return <Paint grid={gridFromAscii(chosenArt)} />;
    }

    return <ChooseArt artSubmissionCallback={setChosenArt} />;
};
