Full Toolkit for Next-Level Domain Analysis
Add shortcut bookmarklet 🔖
Felix Wotschofskyd7825ad6a139
diff --git a/components/BookmarkletLink.tsx b/components/BookmarkletLink.tsxnew file mode 100644index 0000000..a77274c--- /dev/null+++ b/components/BookmarkletLink.tsx@@ -0,0 +1,36 @@+import { Center, Link, Progress } from '@chakra-ui/react';+import { useEffect, useState } from 'react';++const BookmarkletLink = () => {+ const [target, setTarget] = useState('');++ useEffect(() => {+ const rawScript = `+ (function(){+ var tab = window.open('${location.origin}/lookup/'+location.hostname, '_blank');+ if (!tab) {+ alert('Could not open results in new tab!');+ return;+ }+ tab.focus();+ })();+ `;+ const minifiedScript = rawScript+ .split('\n')+ .map((line) => line.trim())+ .join('');+ setTarget(`javascript:${minifiedScript}`);+ }, []);++ if (!target) {+ return <Progress size="xs" isIndeterminate />;+ }++ return (+ <Center>+ <Link href={target}>Inspect Domain</Link>+ </Center>+ );+};++export default BookmarkletLink;diff --git a/pages/index.tsx b/pages/index.tsxindex 30abc0b..cffd7e1 100644--- a/pages/index.tsx+++ b/pages/index.tsx@@ -1,6 +1,7 @@import Head from 'next/head';-import { useColorModeValue, Heading, Container, Flex } from '@chakra-ui/react';+import { Container, Heading, Text, useColorModeValue } from '@chakra-ui/react';+import BookmarkletLink from '@/components/BookmarkletLink';import SearchForm from '@/components/SearchForm';// Based on simple newsletter template from https://chakra-templates.dev@@ -32,6 +33,31 @@ const Home = () => {<SearchForm /></Container>++ <Container+ maxW="lg"+ bg={useColorModeValue('white', 'whiteAlpha.100')}+ boxShadow="xl"+ rounded="lg"+ my={16}+ p={6}+ direction="column"+ >+ <Heading+ as="h2"+ fontSize={{ base: 'xl', sm: '2xl' }}+ textAlign="center"+ mb={5}+ >+ Quickly inspect any Website+ </Heading>++ <Text mt={2} mb={5} textAlign="center" color={'gray.500'}>+ Drag this link to your bookmarks bar to quickly go to the results page+ for the site you are currently on!+ </Text>+ <BookmarkletLink />+ </Container></>);};