Skip to content

Commit 6157632

Browse files
committed
Add register form + email confirm #640 #544 #489 #276
1 parent 55a3aca commit 6157632

35 files changed

+1038
-318
lines changed

CONTRIBUTE.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ Clone the repo and run `cargo run` from each folder (e.g. `cli` or `server`).
4747
- Go to `browser` and run `pnpm dev` to start the browsre
4848
- Visit your `localhost` in your locally running `atomic-data-browser` instance: (e.g. `http://localhost:8080/app/show?subject=http%3A%2F%2Flocalhost`)
4949
- use `cargo watch -- cargo run --bin atomic-server -- --env-file server/.env` to automatically recompile `atomic-server` when you update code or JS assets.
50-
- If you want to debug emails: `brew install mailhog` => `mailhog` => `http://localhost:8025`
50+
- If you want to debug emails: `brew install mailhog` => `mailhog` => `http://localhost:8025` and add `ATOMIC_SMTP_HOST=localhost` `ATOMIC_SMTP_PORT=1025` to your `.env`.
5151

5252
## Improve local compilation speed
5353

browser/CHANGELOG.md

+13
Original file line numberDiff line numberDiff line change
@@ -19,20 +19,33 @@ This changelog covers all three packages, as they are (for now) updated as a who
1919
- Add `store.getResourceAncestry` method, which returns the ancestry of a resource, including the resource itself.
2020
- Add `resource.title` property, which returns the name of a resource, or the first property that is can be used to name the resource.
2121
- `store.createSubject` now accepts a `parent` argument, which allows creating nested subjects.
22+
- Add `store.getServerSupports` to know which features a Server supports
23+
24+
### @tomic/react
25+
26+
- Add `useServerSupports` hook to see supported features of the server
2227

2328
## v0.35.0
2429

2530
### @tomic/browser
2631

32+
- Let users register using e-mail address, improve sign-up UX.
33+
- Add `Store.parseMetaTags` to load JSON-AD objects stored in the DOM. Speeds up initial page load by allowing server to set JSON-AD objects in the initial HTML response.
2734
- Move static assets around, align build with server and fix PWA #292
2835
- Add `useChildren` hook and `Store.getChildren` method
2936
- Add new file preview UI for images, audio, text and PDF files.
3037
- Add new file preview types to the folder grid view.
3138
- Fix Dialogue form #308
3239
- Refactor search, escape query strings for Tantivy
3340
- Add `import` context menu, allows importing anywhere
41+
- Let users register using e-mail address, improve sign-up UX.
3442

3543
### @tomic/react
44+
- `store.createSubject` allows creating nested paths
45+
- `store.createSubject` allows creating nested paths
46+
- Add `useChildren` hook and `Store.getChildren` method
47+
- Add `Store.postToServer` method, add `endpoints`, `import_json_ad_string`
48+
- Add `store.preloadClassesAndProperties` and remove `urls.properties.getAll` and `urls.classes.getAll`. This enables using `atomic-data-browser` without relying on `atomicdata.dev` being available.
3649

3750
- Add more options to `useSearch`
3851

browser/data-browser/src/components/CodeBlock.tsx

+12-3
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,11 @@ import { Button } from './Button';
77
interface CodeBlockProps {
88
content?: string;
99
loading?: boolean;
10+
wrapContent?: boolean;
1011
}
1112

12-
export function CodeBlock({ content, loading }: CodeBlockProps) {
13+
/** Codeblock with copy feature */
14+
export function CodeBlock({ content, loading, wrapContent }: CodeBlockProps) {
1315
const [isCopied, setIsCopied] = useState<string | undefined>(undefined);
1416

1517
function copyToClipboard() {
@@ -19,7 +21,7 @@ export function CodeBlock({ content, loading }: CodeBlockProps) {
1921
}
2022

2123
return (
22-
<CodeBlockStyled data-code-content={content}>
24+
<CodeBlockStyled data-code-content={content} wrapContent={wrapContent}>
2325
{loading ? (
2426
'loading...'
2527
) : (
@@ -46,7 +48,12 @@ export function CodeBlock({ content, loading }: CodeBlockProps) {
4648
);
4749
}
4850

49-
export const CodeBlockStyled = styled.pre`
51+
interface Props {
52+
/** Renders all in a single line */
53+
wrapContent?: boolean;
54+
}
55+
56+
export const CodeBlockStyled = styled.pre<Props>`
5057
position: relative;
5158
background-color: ${p => p.theme.colors.bg1};
5259
border-radius: ${p => p.theme.radius};
@@ -55,4 +62,6 @@ export const CodeBlockStyled = styled.pre`
5562
font-family: monospace;
5663
width: 100%;
5764
overflow-x: auto;
65+
word-wrap: ${p => (p.wrapContent ? 'break-word' : 'initial')};
66+
white-space: ${p => (p.wrapContent ? 'pre-wrap' : 'pre')};
5867
`;

browser/data-browser/src/components/Dialog/useDialog.tsx

+7-7
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
11
import { useCallback, useMemo, useState } from 'react';
22
import { InternalDialogProps } from './index';
33

4-
export type UseDialogReturnType = [
4+
export type UseDialogReturnType = {
55
/** Props meant to pass to a {@link Dialog} component */
6-
dialogProps: InternalDialogProps,
6+
dialogProps: InternalDialogProps;
77
/** Function to show the dialog */
8-
show: () => void,
8+
show: () => void;
99
/** Function to close the dialog */
10-
close: () => void,
10+
close: () => void;
1111
/** Boolean indicating wether the dialog is currently open */
12-
isOpen: boolean,
13-
];
12+
isOpen: boolean;
13+
};
1414

1515
/** Sets up state, and functions to use with a {@link Dialog} */
1616
export const useDialog = (): UseDialogReturnType => {
@@ -40,5 +40,5 @@ export const useDialog = (): UseDialogReturnType => {
4040
[showDialog, close, handleClosed],
4141
);
4242

43-
return [dialogProps, show, close, visible];
43+
return { dialogProps, show, close, isOpen: visible };
4444
};

browser/data-browser/src/components/ErrorLook.tsx

+16-7
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import { lighten } from 'polished';
22
import styled from 'styled-components';
33
import React from 'react';
44
import { FaExclamationTriangle } from 'react-icons/fa';
5+
import { Column } from './Row';
56

67
export const ErrorLook = styled.span`
78
color: ${props => props.theme.colors.alert};
@@ -21,13 +22,21 @@ export function ErrorBlock({ error, showTrace }: ErrorBlockProps): JSX.Element {
2122
<FaExclamationTriangle />
2223
Something went wrong
2324
</BiggerText>
24-
<CodeBlock>{error.message}</CodeBlock>
25-
{showTrace && (
26-
<>
27-
<span>Stack trace:</span>
28-
<CodeBlock>{error.stack}</CodeBlock>
29-
</>
30-
)}
25+
<Column>
26+
<CodeBlock>{error.message}</CodeBlock>
27+
{showTrace && (
28+
<>
29+
Stack trace:
30+
<CodeBlock
31+
style={{
32+
maxHeight: '10rem',
33+
}}
34+
>
35+
{error.stack}
36+
</CodeBlock>
37+
</>
38+
)}
39+
</Column>
3140
</ErrorLookBig>
3241
);
3342
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
import React from 'react';
2+
import { useSettings } from '../helpers/AppSettings';
3+
import { RegisterSignIn } from './RegisterSignIn';
4+
5+
/**
6+
* The Guard can be wrapped around a Component that depends on a user being logged in.
7+
* If the user is not logged in, it will show a button to sign up / sign in.
8+
* Show to users after a new Agent has been created.
9+
* Instructs them to save their secret somewhere safe
10+
*/
11+
export function Guard({ children }: React.PropsWithChildren<any>): JSX.Element {
12+
const { agent } = useSettings();
13+
14+
if (agent) {
15+
return <>{children}</>;
16+
} else return <RegisterSignIn />;
17+
}

browser/data-browser/src/components/NewInstanceButton/NewBookmarkButton.tsx

+2-2
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ export function NewBookmarkButton({
3636

3737
const [url, setUrl] = useState('');
3838

39-
const [dialogProps, show, hide] = useDialog();
39+
const { dialogProps, show, close } = useDialog();
4040

4141
const createResourceAndNavigate = useCreateAndNavigate(klass, parent);
4242

@@ -86,7 +86,7 @@ export function NewBookmarkButton({
8686
</form>
8787
</DialogContent>
8888
<DialogActions>
89-
<Button onClick={hide} subtle>
89+
<Button onClick={close} subtle>
9090
Cancel
9191
</Button>
9292
<Button onClick={onDone} disabled={url.trim() === ''}>

browser/data-browser/src/components/Parent.tsx

+2-1
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ const ParentWrapper = styled.nav`
6767
flex-direction: row;
6868
align-items: center;
6969
justify-content: flex-start;
70-
70+
overflow-y: hidden;
7171
view-transition-name: breadcrumb-bar;
7272
`;
7373

@@ -115,6 +115,7 @@ const BreadCrumbBase = css`
115115
font-family: ${props => props.theme.fontFamily};
116116
padding: 0.1rem 0.5rem;
117117
color: ${p => p.theme.colors.textLight};
118+
white-space: nowrap;
118119
`;
119120

120121
const BreadCrumbCurrent = styled.div`

0 commit comments

Comments
 (0)