Skip to content

Commit 45572fe

Browse files
authored
eng-1247 account page (#110)
1 parent 01a370c commit 45572fe

File tree

6 files changed

+89
-4
lines changed

6 files changed

+89
-4
lines changed

Diff for: src/ui/app/index.tsx

+2-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import React, { useEffect, useState } from 'react';
22
import ReactDOM from 'react-dom/client';
33
import { BrowserRouter, Routes, Route, Link, Navigate, useLocation } from "react-router-dom";
44
import { Thing } from '../.';
5-
import { HomePage, DataPage, IntegrationsPage, IntegrationDetailsPage, WorkflowPage, WorkflowsPage, LoginPage } from '@aqueducthq/common';
5+
import { HomePage, DataPage, IntegrationsPage, IntegrationDetailsPage, WorkflowPage, WorkflowsPage, LoginPage, AccountPage } from '@aqueducthq/common';
66
import { store } from './stores/store';
77
import { Provider } from 'react-redux';
88
import { useUser, UserProfile } from '@aqueducthq/common';
@@ -33,6 +33,7 @@ const App = () => {
3333
<Route path="/integration/:id" element={<RequireAuth user={user}><IntegrationDetailsPage user={user} /> </RequireAuth>} />
3434
<Route path="/workflows" element={<RequireAuth user={user}><WorkflowsPage user={user} /> </RequireAuth>} />
3535
<Route path="/login" element={ user && user.apiKey ? <Navigate to="/" replace /> : <LoginPage />} />
36+
<Route path="/account" element={<RequireAuth user={user}><AccountPage user={user} /> </RequireAuth>} />
3637
<Route path="/workflow/:id" element={<RequireAuth user={user}><WorkflowPage user={user} /> </RequireAuth>} />
3738
</Routes>
3839
);

Diff for: src/ui/common/package-lock.json

+2-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Diff for: src/ui/common/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "@aqueducthq/common",
33
"author": "Aqueduct <[email protected]",
4-
"version": "0.0.7",
4+
"version": "0.0.8",
55
"main": "dist/index.js",
66
"typings": "dist/index.d.ts",
77
"alias": {

Diff for: src/ui/common/src/components/layouts/codeblock.tsx

+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
import React from 'react';
2+
import SyntaxHighlighter from 'react-syntax-highlighter';
3+
import { docco } from 'react-syntax-highlighter/dist/cjs/styles/hljs';
4+
5+
type Props = {
6+
language: string;
7+
children: any;
8+
};
9+
10+
export const CodeBlock: React.FC<Props> = ({ language, children }) => {
11+
return (
12+
<SyntaxHighlighter
13+
language={language}
14+
style={docco}
15+
customStyle={{ borderRadius: 4, padding: '15px' }}
16+
>
17+
{children}
18+
</SyntaxHighlighter>
19+
);
20+
};
21+
22+
export default CodeBlock;

Diff for: src/ui/common/src/components/pages/AccountPage.tsx

+58
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
import Box from '@mui/material/Box';
2+
import Typography from '@mui/material/Typography';
3+
import React, { useEffect } from 'react';
4+
5+
import UserProfile from '../../utils/auth';
6+
import { useAqueductConsts } from '../hooks/useAqueductConsts';
7+
import CodeBlock from '../layouts/codeblock';
8+
import DefaultLayout from '../layouts/default';
9+
10+
type AccountPageProps = {
11+
user: UserProfile;
12+
};
13+
14+
const AccountPage: React.FC<AccountPageProps> = ({ user }) => {
15+
// Set the title of the page on page load.
16+
useEffect(() => {
17+
document.title = 'Account | Aqueduct';
18+
}, []);
19+
20+
const { apiAddress } = useAqueductConsts();
21+
const serverAddress = apiAddress ? `${apiAddress}` : '<server address>';
22+
const apiConnectionSnippet = `import aqueduct
23+
client = aqueduct.Client(
24+
"${user.apiKey}",
25+
"${serverAddress}"
26+
)`;
27+
const maxContentWidth = '600px';
28+
29+
return (
30+
<DefaultLayout user={user}>
31+
<Typography variant="h2" gutterBottom component="div">
32+
Account Overview
33+
</Typography>
34+
35+
<Typography variant="h5" sx={{ mt: 3 }}>
36+
API Key
37+
</Typography>
38+
<Box sx={{ my: 1 }}>
39+
<code>{user.apiKey}</code>
40+
</Box>
41+
42+
<Box
43+
sx={{
44+
display: 'flex',
45+
flexDirection: 'column',
46+
width: maxContentWidth,
47+
}}
48+
>
49+
<Typography variant="body1" sx={{ fontWeight: 'bold', mr: '8px' }}>
50+
Python SDK Connection Snippet
51+
</Typography>
52+
<CodeBlock language="python">{apiConnectionSnippet}</CodeBlock>
53+
</Box>
54+
</DefaultLayout>
55+
);
56+
};
57+
58+
export default AccountPage;

Diff for: src/ui/common/src/index.tsx

+4
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ import { RedshiftDialog } from './components/integrations/dialogs/redshiftDialog
2929
import { S3Dialog } from './components/integrations/dialogs/s3Dialog';
3030
import { SnowflakeDialog } from './components/integrations/dialogs/snowflakeDialog';
3131
import { Card } from './components/layouts/card';
32+
import CodeBlock from './components/layouts/codeblock';
3233
import DataPreviewer from './components/layouts/data_previewer';
3334
import DefaultLayout, { MenuSidebarOffset } from './components/layouts/default';
3435
import MenuSidebar, {
@@ -48,6 +49,7 @@ import AqueductSidebar, {
4849
} from './components/layouts/sidebar/AqueductSidebar';
4950
import { NotificationListItem } from './components/notifications/NotificationListItem';
5051
import NotificationsPopover from './components/notifications/NotificationsPopover';
52+
import AccountPage from './components/pages/AccountPage';
5153
import DataPage from './components/pages/data';
5254
import { getServerSideProps } from './components/pages/getServerSideProps';
5355
import HomePage from './components/pages/HomePage';
@@ -206,6 +208,7 @@ import {
206208
} from './utils/workflows';
207209

208210
export {
211+
AccountPage,
209212
AddIntegrations,
210213
addTable,
211214
AddTableDialog,
@@ -230,6 +233,7 @@ export {
230233
CheckLevel,
231234
CheckOperatorNode,
232235
CheckStatus,
236+
CodeBlock,
233237
CollapsedSidebarHeightInPx,
234238
CollapsedSidebarWidthInPx,
235239
CollapsedStatusBarWidthInPx,

0 commit comments

Comments
 (0)