Skip to content

Commit 821e775

Browse files
committed
Add register form + email confirm #640 #544 #489 #276
1 parent 08d359a commit 821e775

38 files changed

+2123
-391
lines changed

CONTRIBUTING.md

+1
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ TL;DR Clone the repo and run `cargo run` from each folder (e.g. `cli` or `server
5050
- Visit your `localhost` in your locally running `atomic-data-browser` instance: (e.g. `http://localhost:5173/app/show?subject=http%3A%2F%2Flocalhost`)
5151
- use `cargo watch -- cargo run` to automatically recompile `atomic-server` when you update JS assets in `browser`
5252
- use `cargo watch -- cargo run --bin atomic-server -- --env-file server/.env` to automatically recompile `atomic-server` when you update code or JS assets.
53+
- 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`.
5354

5455
### IDE setup (VSCode)
5556

browser/CHANGELOG.md

+13
Original file line numberDiff line numberDiff line change
@@ -185,20 +185,33 @@ This changelog covers all five packages, as they are (for now) updated as a whol
185185
- Add `store.getResourceAncestry` method, which returns the ancestry of a resource, including the resource itself.
186186
- Add `resource.title` property, which returns the name of a resource, or the first property that is can be used to name the resource.
187187
- `store.createSubject` now accepts a `parent` argument, which allows creating nested subjects.
188+
- Add `store.getServerSupports` to know which features a Server supports
189+
190+
### @tomic/react
191+
192+
- Add `useServerSupports` hook to see supported features of the server
188193

189194
## v0.35.0
190195

191196
### @tomic/browser
192197

198+
- Let users register using e-mail address, improve sign-up UX.
199+
- 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.
193200
- Move static assets around, align build with server and fix PWA #292
194201
- Add `useChildren` hook and `Store.getChildren` method
195202
- Add new file preview UI for images, audio, text and PDF files.
196203
- Add new file preview types to the folder grid view.
197204
- Fix Dialogue form #308
198205
- Refactor search, escape query strings for Tantivy
199206
- Add `import` context menu, allows importing anywhere
207+
- Let users register using e-mail address, improve sign-up UX.
200208

201209
### @tomic/react
210+
- `store.createSubject` allows creating nested paths
211+
- `store.createSubject` allows creating nested paths
212+
- Add `useChildren` hook and `Store.getChildren` method
213+
- Add `Store.postToServer` method, add `endpoints`, `import_json_ad_string`
214+
- 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.
202215

203216
- Add more options to `useSearch`
204217

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

+5-5
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 */
1010
close: (success?: boolean) => void,
1111
/** Boolean indicating wether the dialog is currently open */
12-
isOpen: boolean,
13-
];
12+
isOpen: boolean;
13+
};
1414

1515
export type UseDialogOptions<E extends HTMLElement> = {
1616
bindShow?: React.Dispatch<boolean>;

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

+12-8
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import { lighten } from 'polished';
22
import { styled, css } from 'styled-components';
33

44
import { FaExclamationTriangle } from 'react-icons/fa';
5+
import { Column } from './Row';
56

67
export const errorLookStyle = css`
78
color: ${props => props.theme.colors.alert};
@@ -25,18 +26,21 @@ export function ErrorBlock({ error, showTrace }: ErrorBlockProps): JSX.Element {
2526
<FaExclamationTriangle />
2627
Something went wrong
2728
</BiggerText>
28-
<Pre>
29-
<code>{error.message}</code>
29+
<Column>
30+
<CodeBlock>{error.message}</CodeBlock>
3031
{showTrace && (
3132
<>
32-
<br />
33-
<br />
34-
<span>Stack trace:</span>
35-
<br />
36-
<code>{error.stack}</code>
33+
Stack trace:
34+
<CodeBlock
35+
style={{
36+
maxHeight: '10rem',
37+
}}
38+
>
39+
{error.stack}
40+
</CodeBlock>
3741
</>
3842
)}
39-
</Pre>
43+
</Column>
4044
</ErrorLookBig>
4145
);
4246
}
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+
}

0 commit comments

Comments
 (0)