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

Merge over commits to sync with develop #16

Merged
merged 11 commits into from
Dec 3, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,3 @@ RUN apt-get update && apt-get install -y \
libxtst6 \
xauth \
xvfb

# Install doppler during build phase
RUN (curl -Ls https://cli.doppler.com/install.sh || wget -qO- https://cli.doppler.com/install.sh) | sh
2 changes: 1 addition & 1 deletion .devcontainer/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
version: '3.8'
version: '3.3'

services:
app:
Expand Down
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ yarn-error.log*
.env

# compiled styles
styles/index.css
/styles/index.css

# compiled server
/dist
Expand Down
2 changes: 2 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ cache:
npm: true
directories:
- ~/.cache
env:
- PORT=8000 NEXT_PUBLIC_API_HOST=https://devapi.adsabs.harvard.edu/v1 HOST=http://localhost:8000
git:
submodules: false
install:
Expand Down
3 changes: 2 additions & 1 deletion .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@
"name": "Next.js Server (debug)",
"runtimeExecutable": "/usr/local/share/npm-global/bin/ts-node",
"env": {
"NODE_OPTIONS": "--inspect"
"NODE_OPTIONS": "--inspect",
"NODE_ENV": "production"
},
"runtimeArgs": ["--project", "tsconfig.server.json", "server/index.ts"],
"port": 9229
Expand Down
2 changes: 1 addition & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
"debug.node.autoAttach": "off"
}
}
9 changes: 0 additions & 9 deletions components/__tests__/numfound.test.tsx

This file was deleted.

4 changes: 2 additions & 2 deletions jest.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ const config: Config.InitialOptions = {
testEnvironment: 'jsdom',
preset: 'ts-jest',
verbose: true,
roots: ['components'],
roots: ['src/components'],
transform: {
'^.+\\.tsx?$': 'ts-jest',
},
Expand All @@ -15,7 +15,7 @@ const config: Config.InitialOptions = {
tsconfig: 'tsconfig.test.json',
},
},
collectCoverageFrom: ['components/**/*.tsx'],
collectCoverageFrom: ['src/components/**/*.tsx'],
coverageThreshold: {
global: {
lines: 0,
Expand Down
2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
"@types/express": "^4.17.8",
"@types/express-rate-limit": "^5.1.0",
"@types/jest": "^26.0.15",
"@types/jest-axe": "^3.5.1",
"@types/morgan": "^1.9.1",
"@types/node": "^14.6.1",
"@types/qs": "^6.9.4",
Expand Down Expand Up @@ -63,6 +64,7 @@
"express": "^4.17.1",
"express-rate-limit": "^5.1.3",
"jest": "^26.6.3",
"jest-axe": "^4.1.0",
"morgan": "^1.10.0",
"next": "^10.0.2-canary.2",
"next-compose-plugins": "^2.2.0",
Expand Down
Binary file modified public/favicon.ico
Binary file not shown.
Binary file removed public/img/favicon-16x16.png
Binary file not shown.
Binary file removed public/img/favicon.ico
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`renders correctly 1`] = `
exports[`renders correctly with no props 1`] = `
<div>
<article
<p
class="text-xs"
role="status"
>
Expand All @@ -11,9 +11,9 @@ exports[`renders correctly 1`] = `
<span
class="font-bold"
>
10
0
</span>
results
</article>
</p>
</div>
`;
22 changes: 22 additions & 0 deletions src/components/__tests__/numfound.test.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import { render } from '@testing-library/react';
import { axe, toHaveNoViolations } from 'jest-axe';
import React from 'react';
import NumFound from '../numfound';
expect.extend(toHaveNoViolations);

test('renders correctly with no props', async () => {
const { container } = render(<NumFound />);
expect(container).toMatchSnapshot();
expect(container).toHaveTextContent('Your search returned 0 results');
});

test('renders correctly with prop', async () => {
const { container } = render(<NumFound numFound={10} />);
expect(container).toHaveTextContent('Your search returned 10 results');
});

test('Has no accessibility violations', async () => {
render(<NumFound />);
const results = await axe(document.body);
expect(results).toHaveNoViolations();
});
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
import { DetailedHTMLProps, InputHTMLAttributes } from 'react';
import React, { DetailedHTMLProps, InputHTMLAttributes } from 'react';

const Checkbox: React.FC<DetailedHTMLProps<
InputHTMLAttributes<HTMLInputElement>,
HTMLInputElement
>> = (props) => {
const Checkbox: React.FC<
DetailedHTMLProps<InputHTMLAttributes<HTMLInputElement>, HTMLInputElement>
> = (props) => {
const { children, ...inputProps } = props;

return (
Expand Down
9 changes: 4 additions & 5 deletions components/base/radio.tsx → src/components/base/radio.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
import { DetailedHTMLProps, InputHTMLAttributes } from 'react';
import React, { DetailedHTMLProps, InputHTMLAttributes } from 'react';

const Radio: React.FC<DetailedHTMLProps<
InputHTMLAttributes<HTMLInputElement>,
HTMLInputElement
>> = (props) => {
const Radio: React.FC<
DetailedHTMLProps<InputHTMLAttributes<HTMLInputElement>, HTMLInputElement>
> = (props) => {
const { children, ...inputProps } = props;

return (
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { DetailedHTMLProps, TextareaHTMLAttributes } from 'react';
import React, { DetailedHTMLProps, TextareaHTMLAttributes } from 'react';

interface ITextareaProps
extends DetailedHTMLProps<
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { DetailedHTMLProps, InputHTMLAttributes } from 'react';
import React, { DetailedHTMLProps, InputHTMLAttributes } from 'react';

interface ITextboxProps
extends DetailedHTMLProps<
Expand Down
3 changes: 2 additions & 1 deletion components/footer.tsx → src/components/footer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import {
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
import Image from 'next/image';
import Link from 'next/link';
import React from 'react';

const SimpleLink: React.FC<{ href: string; icon?: IconProp }> = ({
children,
Expand Down Expand Up @@ -85,7 +86,7 @@ const Footer: React.FC = () => {
</div>
</div>
<div className="flex-col text-gray-100">
<p className="text-lg text-gray-100 mb-3">Resources</p>
<p className="text-lg mb-3">Resources</p>
<SimpleLink href="/about" icon={faQuestionCircle}>
About ADS
</SimpleLink>
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
6 changes: 3 additions & 3 deletions components/numfound.tsx → src/components/numfound.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@ import React from 'react';

const NumFound: React.FC<INumFoundProps> = React.memo(({ numFound = 0 }) => {
return (
<article role="status" className="text-xs">
<p role="status" className="text-xs">
Your search returned{' '}
<span className="font-bold">{numFound.toLocaleString()}</span> results
</article>
</p>
);
});

interface INumFoundProps {
numFound: number;
numFound?: number;
}

export default NumFound;
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -63,63 +63,8 @@ const SearchBar: React.FC<ISearchBarProps> = () => {
</div>
</div>
);

// const classes = useStyles();

// return (
// <Autocomplete
// id="search-input"
// options={['test', 'test2']}
// openOnFocus={false}
// renderInput={(params) => (
// <Paper className={classes.root} innerRef={params.InputProps.ref}>
// <InputBase
// placeholder="Search"
// name="q"
// defaultValue={value}
// {...params.inputProps}
// className={classes.input}
// />
// <QuickFields />
// <IconButton
// className={classes.searchButton}
// aria-label="search"
// type="submit"
// >
// <SearchIcon />
// </IconButton>
// </Paper>
// )}
// />
// );
};

interface ISearchBarProps extends React.InputHTMLAttributes<HTMLInputElement> {}

// const useStyles = makeStyles((theme: Theme) =>
// createStyles({
// root: {
// padding: 0,
// display: 'flex',
// alignItems: 'center',
// width: '100%',
// },
// input: {
// marginLeft: theme.spacing(1),
// flex: 1,
// },
// iconButton: {
// padding: 10,
// },
// searchButton: {
// borderRadius: '0 4px 4px 0',
// color: theme.palette.getContrastText(theme.palette.secondary.main),
// backgroundColor: theme.palette.secondary.main,
// '&:hover': {
// backgroundColor: theme.palette.secondary.dark,
// },
// },
// })
// );

export default SearchBar;
File renamed without changes.
2 changes: 1 addition & 1 deletion pages/_app.tsx → src/pages/_app.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import Layout from '@components/layout';
import '@styles/index.css';
import { AppProps } from 'next/app';
import Head from 'next/head';
import React from 'react';
import { RecoilRoot } from 'recoil';
import '../styles/index.css';

const NectarApp = ({ Component, pageProps }: AppProps) => {
return (
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion pages/classic-form.tsx → src/pages/classic-form.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ const renderCollectionCheckboxes = (selected: string[]) => {
<span className="mr-1">Limit query to:</span>
<>
{['astronomy', 'physics', 'general'].map((label) => (
<label className="inline-flex items-center mx-1">
<label className="inline-flex items-center mx-1" key={label}>
<input
type="checkbox"
className="form-checkbox"
Expand Down
30 changes: 0 additions & 30 deletions pages/index.tsx → src/pages/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -61,36 +61,6 @@ const Home: React.FC = () => {
);
};

// const IsolatedSearchBar = () => {
// const [value, setValue] = React.useState('');
// const handleClear = () => {
// setValue('');
// };
// const handleChange = (e: React.ChangeEvent<HTMLInputElement>) => {
// setValue(e.currentTarget.value);
// };

// const handleExampleClick = (text: string) => {
// setValue(`${value} ${text}`);
// };

// return (
// <>
// <div className="my-6">
// <SearchBar
// value={value}
// onChange={handleChange}
// onClear={handleClear}
// />
// </div>
// <div className="mt-4">
// <h3 className="text-lg text-center mb-3 font-bold">Search Examples</h3>
// <SearchExamples onClick={handleExampleClick} />
// </div>
// </>
// );
// };

const SearchExamples = React.memo<{ onClick(text: string): void }>(
({ onClick }) => {
const examplesLeft = [
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Loading