Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New How it works modal on HomePage and minor UX tweeks #37

Merged
merged 15 commits into from
Mar 27, 2023
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
credentials.sql
credentials.sql
mivasconcelos marked this conversation as resolved.
Show resolved Hide resolved
previewConfig.json
sandeshvijayraj marked this conversation as resolved.
Show resolved Hide resolved
1 change: 0 additions & 1 deletion web/src/components/GithubButtons.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ export const GithubStargazer: React.FC<GithubStargazerProps> = ({
repoName,
}) => {
const [stargazersCount, setStargazersCount] = React.useState(0);

sandeshvijayraj marked this conversation as resolved.
Show resolved Hide resolved
const handleFlexRedirect = () => {
window.open(`https://github.com/${owner}/${repoName}`, "_blank");
};
Expand Down
20 changes: 6 additions & 14 deletions web/src/components/dataConfigForm/DatabaseConfigFormAutomatic.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Link, SimpleGrid, Stack, Text } from "@chakra-ui/react";
import { SimpleGrid, Stack, Text } from "@chakra-ui/react";
import * as React from "react";
import { useRecoilState } from "recoil";

Expand Down Expand Up @@ -29,7 +29,7 @@ export const DatabaseConfigForm = ({
if (showDatabase) {
databaseInput = (
<ConfigInput
label="Database"
label="Martech database name"
sandeshvijayraj marked this conversation as resolved.
Show resolved Hide resolved
placeholder="martech"
value={database}
setValue={setDatabase}
Expand All @@ -45,30 +45,22 @@ export const DatabaseConfigForm = ({
return (
<Stack spacing={4}>
<ConfigInput
label="Host & Port"
label="Workspace Host"
placeholder="http://127.0.0.1:8808"
sandeshvijayraj marked this conversation as resolved.
Show resolved Hide resolved
value={host}
setValue={setHost}
helpText={
<Text>
The protocol (http, https), host, and port for the SingleStore{" "}
<Link href="https://docs.singlestore.com/docs/http-api" isExternal>
Data API
</Link>
.
</Text>
}
helpText={<Text>Your workspace hostname.</Text>}
sandeshvijayraj marked this conversation as resolved.
Show resolved Hide resolved
/>
<SimpleGrid columns={2} gap={2}>
<ConfigInput
label="Username"
label="Workspace group username"
helpText="Fill in the Security credentials of your workspace group."
placeholder="admin"
value={user}
setValue={setUser}
/>
<ConfigInput
label="Password"
label="Workspace group password"
placeholder=""
value={password}
setValue={setPassword}
Expand Down
19 changes: 5 additions & 14 deletions web/src/components/dataConfigForm/DatabaseConfigFormManual.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import {
Box,
Link,
SimpleGrid,
Stack,
Text,
Expand Down Expand Up @@ -81,7 +80,7 @@ export const DatabaseConfigFormManual = ({
if (showDatabase) {
databaseInput = (
<ConfigInput
label="Database"
label="Martech Database name"
sandeshvijayraj marked this conversation as resolved.
Show resolved Hide resolved
placeholder="martech"
required
value={localDatabase}
Expand Down Expand Up @@ -114,32 +113,24 @@ export const DatabaseConfigFormManual = ({
return (
<Stack spacing={4} onKeyDown={handleEnterKeyPress}>
<ConfigInput
label="Host & Port"
label="Workspace Host"
placeholder="http://127.0.0.1:8808"
sandeshvijayraj marked this conversation as resolved.
Show resolved Hide resolved
value={localHost}
required
setValue={setLocalHost}
helpText={
<Text>
The protocol (http, https), host, and port for the SingleStore{" "}
<Link href="https://docs.singlestore.com/docs/http-api/" isExternal>
Data API
</Link>
.
</Text>
}
helpText={<Text>Your workspace hostname.</Text>}
sandeshvijayraj marked this conversation as resolved.
Show resolved Hide resolved
/>
<SimpleGrid columns={2} gap={2}>
<ConfigInput
label="Username"
label="Workspace group username"
required
helpText="Fill in the Security credentials of your workspace group."
placeholder="admin"
value={localUser}
setValue={setLocalUser}
/>
<ConfigInput
label="Password"
label="Workspace group password"
required
placeholder=""
value={localPassword}
Expand Down
2 changes: 1 addition & 1 deletion web/src/data/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ export const selectableCitiesData: Array<City> = [
},
{
id: 120658,
name: "New York City",
sandeshvijayraj marked this conversation as resolved.
Show resolved Hide resolved
name: "New York",
centerLat: 40.71427003,
centerLon: -74.00597003,
diameter: 0.4,
Expand Down
4 changes: 2 additions & 2 deletions web/src/pages/Analytics.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ const DashboardContainerChild = () => {
<Stack gap={10}>
<Stack spacing={3}>
<Stack spacing={2}>
<Heading fontSize="md">Engagement</Heading>
<Heading fontSize="xl">Engagement</Heading>
sandeshvijayraj marked this conversation as resolved.
Show resolved Hide resolved
<Text overflowWrap="break-word">
Conversion rate with subscribers
</Text>
Expand All @@ -142,7 +142,7 @@ const DashboardContainerChild = () => {
</Stack>
<Stack spacing={3}>
<Stack spacing={2}>
<Heading fontSize="md">Top Performing Customers</Heading>
<Heading fontSize="xl">Top Performing Customers</Heading>
<Text overflowWrap="break-word">
Companies with the highest conversion rate
</Text>
Expand Down
8 changes: 4 additions & 4 deletions web/src/pages/Configure.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -114,17 +114,17 @@ const CollapsibleSection = ({
<div style={containerStyle}>
<Button
justifyContent="space-between"
size="sm"
size="md"
width="100%"
style={buttonStyle}
onClick={() => setSectionOpen(!sectionOpen)}
>
{title}
{accordionIcon}
</Button>
<div style={childContainerStyle}>
<Box style={childContainerStyle}>
sandeshvijayraj marked this conversation as resolved.
Show resolved Hide resolved
<Collapse in={sectionOpen}>{childComponent}</Collapse>
</div>
</Box>
</div>
);
};
Expand Down Expand Up @@ -1103,7 +1103,7 @@ export const Configure = () => {
>
<Flex gap={5} justifyContent="space-between" marginBottom="50px">
<Stack spacing={2}>
<Heading fontSize="md">Setting up Your Application</Heading>
<Heading fontSize="xl">Setting up Your Application</Heading>
<Text size="xs" overflowWrap="break-word">
Connect to a SingleStoreDB workspace to see how we power the
real-time Digital Marketing applications. If you have any questions
Expand Down
6 changes: 3 additions & 3 deletions web/src/pages/Dashboard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ const RealtimeChart = () => {
<Stack spacing={4}>
<Stack spacing={3}>
<Stack spacing={2}>
<Heading size="md">Key Metrics</Heading>
<Heading fontSize="xl">Key Metrics</Heading>
<Text>Serving ads real-time to simulated subscribers</Text>
</Stack>
</Stack>
Expand Down Expand Up @@ -195,7 +195,7 @@ const StatsWrapper = () => {
<Stack spacing={4}>
<Stack spacing={3}>
<Stack spacing={2}>
<Heading fontSize="md">Locations</Heading>
<Heading fontSize="xl">Locations</Heading>
<Text overflowWrap="break-word">
Select cities to add to the dataset
</Text>
Expand Down Expand Up @@ -266,7 +266,7 @@ export const NotificationsMap = () => {
left={0}
top={0}
overflow={isSmallScreen ? undefined : "auto"}
width={isSmallScreen ? "100%" : "30%"}
width={isSmallScreen ? "100%" : "31%"}
sandeshvijayraj marked this conversation as resolved.
Show resolved Hide resolved
height={isSmallScreen ? "auto" : "100%"}
borderBottomRightRadius="10px"
padding="36px 48px 36px 48px"
Expand Down
102 changes: 56 additions & 46 deletions web/src/pages/HomePage.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { InfoIcon } from "@chakra-ui/icons";
import {
Flex,
Grid,
Expand All @@ -12,6 +13,7 @@ import {
TabPanels,
Tabs,
Text,
Tooltip,
useColorModeValue,
useMediaQuery,
} from "@chakra-ui/react";
Expand All @@ -23,13 +25,65 @@ import GraphicalBackground2 from "@/assets/graphical-background-2.svg";
import SingleStoreLogoDark from "@/assets/singlestore-logo-dark.svg";
import SinglestoreLogo from "@/assets/singlestore-logo-filled-sm.svg";
import { DatabaseConfigFormManual } from "@/components/dataConfigForm/DatabaseConfigFormManual";
import { HowItWorksModal } from "@/components/HowItWorksModal";
import { useUpdateCityList } from "@/data/models/useUpdateCityList";
import { useConnectionState } from "@/view/hooks/hooks";

const ConnectSection: React.FC = () => {
const fontColor = useColorModeValue("#553ACF", "#CCC3F9");

return (
<Stack spacing={4}>
<Heading>
<Image src={useColorModeValue(SinglestoreLogo, SingleStoreLogoDark)} />
</Heading>
<Heading>
<Text>Real-Time Digital Marketing</Text>
</Heading>
<Text size="1.2em">
Watch{" "}
<Link
fontWeight="bold"
href="https://portal.singlestore.com"
isExternal
>
SingleStoreDB
</Link>{" "}
serve ads to millions of simulated subscribers based on their behavior,
purchases, request history, and geolocation.
</Text>
<Tabs variant="unstyled">
<TabList>
<Tab
justifyContent="center"
_selected={{
color: fontColor,
borderBottom: `2px solid ${useColorModeValue(
"#553ACF",
"#CCC3F9"
)}`,
}}
fontWeight="bold"
gap={1}
>
Connect to Singlestore
</Tab>
</TabList>
<TabPanels padding={0} margin={0}>
<TabPanel paddingLeft={0} paddingTop={5} margin={0}>
<DatabaseConfigFormManual showDatabase />
<br />
<HowItWorksModal />
sandeshvijayraj marked this conversation as resolved.
Show resolved Hide resolved
</TabPanel>
</TabPanels>
</Tabs>
</Stack>
);
};

export const HomePage: React.FC = () => {
const { connected } = useConnectionState();
const navigate = useNavigate();
const fontColor = useColorModeValue("#553ACF", "#CCC3F9");
const [isSmallScreen] = useMediaQuery("(max-width: 640px)");
const { updateCityList } = useUpdateCityList();

Expand All @@ -49,51 +103,7 @@ export const HomePage: React.FC = () => {
alignItems="center"
>
<GridItem padding="10% 10% 10% 20%">
<Stack spacing={4}>
<Heading>
<Image
src={useColorModeValue(SinglestoreLogo, SingleStoreLogoDark)}
/>
</Heading>
<Heading>
<Text>Real-Time Digital Marketing</Text>
</Heading>
<Text size="1.2em">
Watch{" "}
<Link
fontWeight="bold"
href="https://portal.singlestore.com"
isExternal
>
SingleStoreDB
</Link>{" "}
serve ads to millions of simulated subscribers based on their
behavior, purchases, request history, and geolocation.
</Text>
<Tabs variant="unstyled">
<TabList>
<Tab
justifyContent="center"
_selected={{
color: fontColor,
borderBottom: `2px solid ${useColorModeValue(
"#553ACF",
"#CCC3F9"
)}`,
}}
fontWeight="bold"
gap={1}
>
Connect to Singlestore
</Tab>
</TabList>
<TabPanels padding={0} margin={0}>
<TabPanel paddingLeft={0} paddingTop={5} margin={0}>
<DatabaseConfigFormManual showDatabase />
</TabPanel>
</TabPanels>
</Tabs>
</Stack>
<ConnectSection />
</GridItem>
<GridItem
backgroundImage={GraphicalBackground2}
Expand Down