From 34ede2d344e0e507b05bac65cc1ac747bc43cfbf Mon Sep 17 00:00:00 2001 From: Pavol Hejny Date: Thu, 7 Sep 2023 16:52:54 +0200 Subject: [PATCH 1/8] TODOs and drafts --- .../GraphsAsScenarios/GraphsAsScenarios.tsx | 27 ++++++++++ src/pages/new/from-image.tsx | 1 + src/pages/new/from-prompt.tsx | 6 +-- src/pages/new/from-url.tsx | 51 +++++++++++++++++++ 4 files changed, 82 insertions(+), 3 deletions(-) create mode 100644 src/pages/new/from-url.tsx diff --git a/src/components/GraphsAsScenarios/GraphsAsScenarios.tsx b/src/components/GraphsAsScenarios/GraphsAsScenarios.tsx index 134264cad5..4278742165 100644 --- a/src/components/GraphsAsScenarios/GraphsAsScenarios.tsx +++ b/src/components/GraphsAsScenarios/GraphsAsScenarios.tsx @@ -75,6 +75,33 @@ export function GraphsAsScenarios() { + +
  • + + { + // TODO: !!! Better scenario buttons + let ribbon = MeshBuilder.CreateTorusKnot( + 'ribbon', + { + p: 3, + q: 2, + radius: 1, + tube: 0.3, + radialSegments: 20, + tubularSegments: 5, + }, + scene, + ); + ribbon.scaling = Vector3.One().scale(2.2); + ribbon.rotation = new Vector3(Math.PI / 2, Math.PI / 2, Math.PI / 5); + ribbon.material = wireframeMaterial; + }} + > +

    Website

    your old web to update +
    + +
  • ); } diff --git a/src/pages/new/from-image.tsx b/src/pages/new/from-image.tsx index e3969decfc..ae7746773e 100644 --- a/src/pages/new/from-image.tsx +++ b/src/pages/new/from-image.tsx @@ -30,4 +30,5 @@ export default function NewWallpaperFromImagePage() { /** * TODO: Allow to use Camera (maybe in new route /new/from-camera) + * TODO: [👐] Unite design of all /new/* pages */ diff --git a/src/pages/new/from-prompt.tsx b/src/pages/new/from-prompt.tsx index 0baffb7929..cf525aaccb 100644 --- a/src/pages/new/from-prompt.tsx +++ b/src/pages/new/from-prompt.tsx @@ -1,12 +1,9 @@ import Link from 'next/link'; -import { useRouter } from 'next/router'; import { StaticAppHead } from '../../components/AppHead/StaticAppHead'; import { Center } from '../../components/Center/Center'; import styles from '../../styles/static.module.css' /* <- TODO: [🤶] Get rid of page css and only use components (as ) */; export default function NewWallpaperFromPromptPage() { - const router = useRouter(); - return ( <> @@ -38,3 +35,6 @@ export default function NewWallpaperFromPromptPage() { ); } +/** + * TODO: [👐] Unite design of all /new/* pages + */ diff --git a/src/pages/new/from-url.tsx b/src/pages/new/from-url.tsx new file mode 100644 index 0000000000..e6a92976db --- /dev/null +++ b/src/pages/new/from-url.tsx @@ -0,0 +1,51 @@ +import { useState } from 'react'; +import { StaticAppHead } from '../../components/AppHead/StaticAppHead'; +import { Center } from '../../components/Center/Center'; +import styles from '../../styles/static.module.css' /* <- TODO: [🤶] Get rid of page css and only use components (as ) */; +import { string_url } from '../../utils/typeAliases'; +import { isValidUrl } from '../../utils/validators/isValidUrl'; + +export default function NewWallpaperFromPromptPage() { + const [url, setUrl] = useState(null); + + return ( + <> + + +
    +
    +
    +

    AI Web Maker

    + Write URL to make new web from: + setUrl(event.target.value)} + /> + +
    +
    + + {/* TODO: Make here some footer +
    + +
    + */} +
    + + ); +} + +/** + * TODO: [👐] Unite design of all /new/* pages + * TODO: !!! Create also branch for /new/from-instagram + */ From 4ae2b9ba2024e48ef5ba66f4af1166292f949e44 Mon Sep 17 00:00:00 2001 From: Pavol Hejny Date: Sat, 16 Sep 2023 00:30:38 +0200 Subject: [PATCH 2/8] TODOs --- src/pages/new/from-url.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/pages/new/from-url.tsx b/src/pages/new/from-url.tsx index e6a92976db..1dd04cdae8 100644 --- a/src/pages/new/from-url.tsx +++ b/src/pages/new/from-url.tsx @@ -46,6 +46,6 @@ export default function NewWallpaperFromPromptPage() { } /** + * TODO: !!! Implement * TODO: [👐] Unite design of all /new/* pages - * TODO: !!! Create also branch for /new/from-instagram */ From c5abe908c345f27d435bb35c92d6d53e6154a5bd Mon Sep 17 00:00:00 2001 From: Pavol Hejny Date: Sat, 16 Sep 2023 00:31:54 +0200 Subject: [PATCH 3/8] Scenarios --- .../GraphsAsScenarios/GraphsAsScenarios.tsx | 28 +++---------------- 1 file changed, 4 insertions(+), 24 deletions(-) diff --git a/src/components/GraphsAsScenarios/GraphsAsScenarios.tsx b/src/components/GraphsAsScenarios/GraphsAsScenarios.tsx index 1cda325859..411fad28b5 100644 --- a/src/components/GraphsAsScenarios/GraphsAsScenarios.tsx +++ b/src/components/GraphsAsScenarios/GraphsAsScenarios.tsx @@ -31,34 +31,14 @@ export function GraphsAsScenarios() { To upload and generate your website -
  • - { - // TODO: !!! Better scenario buttons - let ribbon = MeshBuilder.CreateTorusKnot( - 'ribbon', - { - p: 3, - q: 2, - radius: 1, - tube: 0.3, - radialSegments: 20, - tubularSegments: 5, - }, - scene, - ); - ribbon.scaling = Vector3.One().scale(2.2); - ribbon.rotation = new Vector3(Math.PI / 2, Math.PI / 2, Math.PI / 5); - ribbon.material = wireframeMaterial; - }} - > -

    Website

    your old web to update -
    + +

    Website

    + To redesign your old site +
  • - ); } From ddd91baa766d77914c60fe2d78f86f5dc9cdaf98 Mon Sep 17 00:00:00 2001 From: Pavol Hejny Date: Sat, 16 Sep 2023 16:34:15 +0200 Subject: [PATCH 4/8] TODOs --- src/pages/new/from-prompt.tsx | 1 + 1 file changed, 1 insertion(+) diff --git a/src/pages/new/from-prompt.tsx b/src/pages/new/from-prompt.tsx index cf525aaccb..c2ac5a7fb0 100644 --- a/src/pages/new/from-prompt.tsx +++ b/src/pages/new/from-prompt.tsx @@ -37,4 +37,5 @@ export default function NewWallpaperFromPromptPage() { /** * TODO: [👐] Unite design of all /new/* pages + * TODO: [🏍] Standardize process of getting input data for new wallpaper */ From 2b1c9891f3b0521d4553a71174279cf13a55e043 Mon Sep 17 00:00:00 2001 From: Pavol Hejny Date: Sat, 16 Sep 2023 17:03:58 +0200 Subject: [PATCH 5/8] Scrape web API endpoint --- src/pages/api/scrape/scrape-web.ts | 34 ++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 src/pages/api/scrape/scrape-web.ts diff --git a/src/pages/api/scrape/scrape-web.ts b/src/pages/api/scrape/scrape-web.ts new file mode 100644 index 0000000000..ce0c838982 --- /dev/null +++ b/src/pages/api/scrape/scrape-web.ts @@ -0,0 +1,34 @@ +import type { NextApiRequest, NextApiResponse } from 'next'; +import { isValidUrl } from '../../../utils/validators/isValidUrl'; + +export interface ScrapeWebResponse { + // TODO: [🌋] ErrorableResponse + + /** + * Information about the Instagram user + */ + webInfo: any /* <- !!! */; +} + +export default async function scrapeInstagramUserHandler( + request: NextApiRequest, + response: NextApiResponse, +) { + const url = request.query.url; + + if (!isValidUrl(url)) { + return response.status(400).json({ message: 'GET param url is not valid URL' } as any /* <-[🌋] */); + } + + const webInfo = await fetch(url as string); + + // console.info('👤', { instagramUser }); + + return response.status(200).json({ webInfo } satisfies ScrapeWebResponse); +} + +/** + * TODO: Maybe API URL for scraping be like> /api/scrape/instagram/@hejny + * TODO: Maybe obtain session_id from username+password + * > const session_id = await getCookie('pavolhejny', '...'); + */ From b9688d0460a619928eea7e238e1ee1c6c48bf22d Mon Sep 17 00:00:00 2001 From: Pavol Hejny Date: Sat, 16 Sep 2023 17:06:57 +0200 Subject: [PATCH 6/8] From URL has same structure as from instagram --- src/pages/new/from-url.tsx | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/src/pages/new/from-url.tsx b/src/pages/new/from-url.tsx index 1dd04cdae8..0436a7da58 100644 --- a/src/pages/new/from-url.tsx +++ b/src/pages/new/from-url.tsx @@ -1,12 +1,12 @@ -import { useState } from 'react'; +import { useRef } from 'react'; import { StaticAppHead } from '../../components/AppHead/StaticAppHead'; import { Center } from '../../components/Center/Center'; import styles from '../../styles/static.module.css' /* <- TODO: [🤶] Get rid of page css and only use components (as ) */; -import { string_url } from '../../utils/typeAliases'; import { isValidUrl } from '../../utils/validators/isValidUrl'; +import type { ScrapeWebResponse } from '../api/scrape/scrape-web'; export default function NewWallpaperFromPromptPage() { - const [url, setUrl] = useState(null); + const urlInputRef = useRef(null); return ( <> @@ -17,17 +17,21 @@ export default function NewWallpaperFromPromptPage() {

    AI Web Maker

    Write URL to make new web from: - setUrl(event.target.value)} - /> +
    +