Skip to content

Commit e83a734

Browse files
authored
Merge branch 'develop' into 543-s3-uploads
2 parents 3ac37e5 + 6337c2f commit e83a734

File tree

21 files changed

+230
-140
lines changed

21 files changed

+230
-140
lines changed

Earthfile

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
VERSION --try --global-cache 0.7
22
PROJECT ontola/atomic-server
33
IMPORT ./browser AS browser
4-
IMPORT github.com/earthly/lib/rust:2.2.11 AS rust
4+
IMPORT github.com/earthly/lib/rust AS rust
55
FROM rust:1.73.0-buster
66
WORKDIR /code
77

@@ -41,20 +41,20 @@ source:
4141
COPY --keep-ts Cargo.toml Cargo.lock ./
4242
COPY --keep-ts --dir server lib cli ./
4343
COPY browser+build/dist /code/browser/data-browser/dist
44+
DO rust+CARGO --args=fetch
4445

4546
cross-build:
4647
FROM +source
4748
ARG --required TARGET
48-
# This does not yet cache properly
49-
# https://github.com/earthly/lib/issues/34
49+
DO rust+GET_RUST_CACHE_MOUNTS
5050
WITH DOCKER
51-
RUN cross build --target $TARGET --release
51+
RUN --mount=$EARTHLY_RUST_CARGO_HOME_CACHE --mount=$EARTHLY_RUST_TARGET_CACHE cross build --target $TARGET --release
5252
END
5353
SAVE ARTIFACT ./target/$TARGET/release/atomic-server AS LOCAL artifact/bin/atomic-server-$TARGET
5454

5555
build:
5656
FROM +source
57-
DO rust+CARGO --args="build --release" --output="release/[^/\.]+"
57+
DO rust+CARGO --args="build --offline --release" --output="release/[^/\.]+"
5858
RUN ./target/release/atomic-server --version
5959
SAVE ARTIFACT ./target/release/atomic-server AS LOCAL artifact/bin/atomic-server-x86_64-unknown-linux-gnu
6060

browser/CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@ This changelog covers all three packages, as they are (for now) updated as a who
77
### Atomic Browser
88

99
- [#747](https://github.com/atomicdata-dev/atomic-server/issues/747) Show ontology classes on new resource page.
10+
- [#770](https://github.com/atomicdata-dev/atomic-server/issues/770) Display more info on search result page.
11+
- [#771](https://github.com/atomicdata-dev/atomic-server/issues/771) Tables: Don't paste in multiple rows when focussed on an input
12+
- [#758](https://github.com/atomicdata-dev/atomic-server/issues/758) Fix Relation column forms to close when clicking on the searchbox
1013
- Fix server not rebuilding client when files changed.
1114

1215
## v0.36.2

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

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,17 +11,19 @@ type CardProps = {
1111
/** A Card with a border. */
1212
export const Card = styled.div<CardProps>`
1313
background-color: ${props => props.theme.colors.bg};
14-
/** Don't put side margins in this component - use a wrapping component */
15-
border: solid 1px ${props => props.theme.colors.bg2};
16-
box-shadow: ${props => props.theme.boxShadow};
14+
15+
border: solid 1px
16+
${props =>
17+
props.highlight ? props.theme.colors.main : props.theme.colors.bg2};
18+
box-shadow: ${props =>
19+
props.highlight
20+
? `0 0 0 1px ${props.theme.colors.main}, ${props.theme.boxShadow}`
21+
: props.theme.boxShadow};
22+
1723
padding: ${props => props.theme.margin}rem;
18-
/* margin-bottom: ${props => props.theme.margin}rem; */
19-
padding-bottom: 0;
2024
border-radius: ${props => props.theme.radius};
2125
max-height: ${props => (props.small ? '10rem' : 'none')};
2226
overflow: ${props => (props.small ? 'hidden' : 'visible')};
23-
border-color: ${props =>
24-
props.highlight ? props.theme.colors.main : props.theme.colors.bg2};
2527
2628
${p => transitionName('resource-page', p.about)};
2729
`;

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

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,6 @@ const NavBarBase = styled.div<NavBarStyledProps>`
166166
/** Width of the floating navbar in rem */
167167
const NavBarFloating = styled(NavBarBase)`
168168
box-shadow: ${props => props.theme.boxShadow};
169-
box-sizing: border-box;
170169
border-radius: 999px;
171170
overflow: hidden;
172171
max-width: calc(100% - 2rem);
@@ -179,6 +178,11 @@ const NavBarFloating = styled(NavBarBase)`
179178
top: ${props => (props.top ? '2rem' : 'auto')};
180179
bottom: ${props => (props.top ? 'auto' : '1rem')};
181180
181+
&:has(input:focus) {
182+
box-shadow: 0px 0px 0px 1px ${props => props.theme.colors.main};
183+
border-color: ${props => props.theme.colors.main};
184+
}
185+
182186
@media (max-width: ${props => props.theme.containerWidth}rem) {
183187
max-width: calc(100% - 1rem);
184188
left: auto;
@@ -198,6 +202,10 @@ const NavBarFixed = styled(NavBarBase)`
198202
props.top ? 'solid 1px ' + props.theme.colors.bg2 : 'none'};
199203
border-top: ${props =>
200204
!props.top ? 'solid 1px ' + props.theme.colors.bg2 : 'none'};
205+
206+
&:has(input:focus) {
207+
box-shadow: 0px 0px 0px 2px ${props => props.theme.colors.main};
208+
}
201209
`;
202210

203211
const SideBarWrapper = styled('div')`

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ function PropVal({
6161
</PropertyLabel>
6262
</AtomicLink>
6363
{editable ? (
64-
<ValueForm resource={resource} propertyURL={propertyURL} noMargin />
64+
<ValueForm resource={resource} propertyURL={propertyURL} />
6565
) : (
6666
<ValueComp
6767
datatype={property.datatype}

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

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,8 @@ const Input = styled.input`
159159
flex: 1;
160160
min-width: 1rem;
161161
background-color: ${props => props.theme.colors.bg};
162-
outline: 0;
162+
// Outline is handled by the Navbar.
163+
outline: none;
163164
color: ${p => p.theme.colors.textLight};
164165
`;
165166

@@ -172,9 +173,7 @@ const Form = styled.form`
172173
border-radius: 999px;
173174
174175
:hover {
175-
box-shadow: inset 0 0 0 2px
176-
${props => transparentize(0.6, props.theme.colors.main)};
177-
176+
${props => transparentize(0.6, props.theme.colors.main)};
178177
${Input} {
179178
color: ${p => p.theme.colors.text};
180179
}
@@ -183,8 +182,9 @@ const Form = styled.form`
183182
${Input} {
184183
color: ${p => p.theme.colors.text};
185184
}
185+
186+
// Outline is handled by the Navbar.
186187
outline: none;
187-
box-shadow: inset 0 0 0 2px ${props => props.theme.colors.main};
188188
}
189189
`;
190190

browser/data-browser/src/components/TableEditor/hooks/usePasteCommand.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,11 @@ export function usePasteCommand<T>(
3838
return;
3939
}
4040

41+
// Don't use custom paste logic when the user is focussed on an input
42+
if (document.activeElement?.tagName === 'INPUT') {
43+
return;
44+
}
45+
4146
const htmlData = event.clipboardData?.getData('text/html');
4247

4348
if (htmlData) {

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

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,10 @@ import { ErrMessage } from './forms/InputStyles';
1616
type Props = {
1717
value: JSONValue;
1818
datatype: Datatype;
19-
noMargin?: boolean;
2019
};
2120

2221
/** Renders a value in a fitting way, depending on its DataType */
23-
function ValueComp({ value, datatype, noMargin }: Props): JSX.Element {
22+
function ValueComp({ value, datatype }: Props): JSX.Element {
2423
try {
2524
switch (datatype) {
2625
case Datatype.ATOMIC_URL: {
@@ -36,7 +35,7 @@ function ValueComp({ value, datatype, noMargin }: Props): JSX.Element {
3635
case (Datatype.DATE, Datatype.TIMESTAMP):
3736
return <DateTime date={valToDate(value)} />;
3837
case Datatype.MARKDOWN:
39-
return <Markdown text={valToString(value)} noMargin={noMargin} />;
38+
return <Markdown text={valToString(value)} />;
4039
case Datatype.RESOURCEARRAY:
4140
return <ResourceArray subjects={valToArray(value)} />;
4241
default:

browser/data-browser/src/components/datatypes/Markdown.tsx

Lines changed: 6 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -3,30 +3,21 @@ import { styled } from 'styled-components';
33
import remarkGFM from 'remark-gfm';
44
import { Button } from '../Button';
55
import { truncateMarkdown } from '../../helpers/markdown';
6-
import { useState } from 'react';
6+
import { FC, useState } from 'react';
77

88
type Props = {
99
text: string;
10-
/**
11-
* By default, all bottom Markdown elements have some margin (e.g. the last
12-
* paragraph). If you set noMargin, this is corrected.
13-
*/
14-
noMargin?: boolean;
1510
renderGFM?: boolean;
1611
/**
1712
* If this is set, and the markdown is more characters than this number, the
1813
* text will be truncated and a button will be shown
1914
*/
2015
maxLength?: number;
16+
className?: string;
2117
};
2218

2319
/** Renders a markdown value */
24-
function Markdown({
25-
text,
26-
noMargin,
27-
renderGFM,
28-
maxLength,
29-
}: Props): JSX.Element | null {
20+
const Markdown: FC<Props> = ({ text, renderGFM, maxLength, className }) => {
3021
const [collapsed, setCollapsed] = useState(true);
3122

3223
maxLength = maxLength || 5000;
@@ -36,7 +27,7 @@ function Markdown({
3627
}
3728

3829
return (
39-
<MarkdownWrapper noMargin={noMargin}>
30+
<MarkdownWrapper className={className}>
4031
<ReactMarkdown remarkPlugins={renderGFM ? [remarkGFM] : []}>
4132
{collapsed ? truncateMarkdown(text, maxLength) : text}
4233
</ReactMarkdown>
@@ -47,19 +38,14 @@ function Markdown({
4738
)}
4839
</MarkdownWrapper>
4940
);
50-
}
41+
};
5142

5243
Markdown.defaultProps = {
5344
renderGFM: true,
5445
};
5546

56-
interface MarkdownWrapperProps {
57-
noMargin?: boolean;
58-
}
59-
60-
const MarkdownWrapper = styled.div<MarkdownWrapperProps>`
47+
const MarkdownWrapper = styled.div`
6148
/* Corrects the margin added by <p> and other HTML elements */
62-
margin-bottom: -${p => (p.noMargin ? p.theme.margin : 0)}rem;
6349
6450
width: 100%;
6551
overflow-x: hidden;

browser/data-browser/src/components/forms/SearchBox/SearchBox.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,7 @@ export function SearchBox({
120120
invalid={!!error}
121121
>
122122
<TriggerButton
123+
type='button'
123124
autoFocus={autoFocus}
124125
disabled={disabled}
125126
ref={triggerRef}

0 commit comments

Comments
 (0)