Skip to content
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
1 change: 1 addition & 0 deletions components/DefaultPage/NavBar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ const NavbarPage = ({ page, path, level }: PageProps) => {
[styles['navbar__link--level-2']]: level === 2,
})}
href={page.path}
title={page.title}
>
{page.title}
</Link>
Expand Down
3 changes: 3 additions & 0 deletions components/DefaultPage/styles.module.scss
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,9 @@
color: #767676;
text-decoration: none;
padding: spacing("md");
text-overflow: ellipsis;
white-space: nowrap;
overflow: hidden;

&:hover {
color: var(--text-color);
Expand Down
3 changes: 2 additions & 1 deletion components/GraphQLExample/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,15 @@ import styles from './styles.module.scss';

interface Props {
document: string;
version: string;
}

export const GraphQLExample = (props: Props) => {
return (
<div>
<Prism className={styles.code} copyLabel="Copy" language="graphql">{props.document}</Prism>
<Paper className={styles.footer}>
<Link className={styles['footer__link']} href={`/fusionfeed/graphql/explorer-and-reference#query=${encodeURIComponent(props.document)}`} target="_blank">
<Link className={styles['footer__link']} href={`/fusionfeed/graphql/explorer-and-reference#version=${props.version}&query=${encodeURIComponent(props.document)}`} target="_blank">
<Image src={graphqlIcon} alt="GraphQL Explorer" />
<span className={styles['footer__text']}>Open in GraphQL Explorer</span>
</Link>
Expand Down
2 changes: 1 addition & 1 deletion components/LoginPage/LoginAgreement.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ export const LoginAgreement = ({ setLoginState }: LoginAgreementProps) => {

const acceptAgreement = () => {
cookie.set('ffagreement', 'true');
const destination = new URLSearchParams(window.location.search).get('destination');
const destination = window.location.hash.length > 1 && new URLSearchParams(window.location.hash.slice(1)).get('destination');
router.push(destination || '/');
};

Expand Down
2 changes: 1 addition & 1 deletion components/LoginPage/LoginForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ export const LoginForm = ({ setLoginState }: LoginFormProps) => {
if (!agreement) {
setLoginState('agreement');
} else {
const destination = new URLSearchParams(window.location.search).get('destination');
const destination = window.location.hash.length > 1 && new URLSearchParams(window.location.hash.slice(1)).get('destination');
router.push(destination || '/');
}
} else {
Expand Down
4 changes: 2 additions & 2 deletions content/fusionfeed/graphql/football/index.mdx
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
---
title: Football
title: Gridiron Football
children:
- enumerating-teams
- navigating-games
- searching-for-plays
---
# Football
# Gridiron Football

In FusionFeed, gridiron football is simply referred to as "football". For association football, see [Soccer](../soccer).

Expand Down
6 changes: 3 additions & 3 deletions content/fusionfeed/graphql/soccer/index.mdx
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
---
title: Soccer
title: Association Football (Soccer)
children:
- navigating-games
---
# Soccer
# Association Football (Soccer)

In FusionFeed, association football is always referred to as "soccer" as opposed to "football", which is used to refer to gridiron football.
In the FusionFeed API, association football is always referred to as "soccer" as opposed to "football", which is used to refer to gridiron football.

FusionFeed provides coverage for a select number of games, primarily amongst Premier League teams.
2 changes: 1 addition & 1 deletion content/fusionfeed/rest/video-preview-images.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ This endpoint requires authentication, so web apps cannot directly use it in the
For example, this request:

```
GET /v2/av-streams/BA~Ag-NUeoMbH8zwMzB8iLxSEVMbcHZ~CJ5byArXySDWly_GOiXnDr7KFtOD/preview.jpg?fit=640x360&t=2021-09-10T00:24:10Z
GET /v2/av-streams/BA~AnZFw9BpHTRq_J84hAVaVYSx34n8~CCgrzL6_hXIKlr0Bd-2mIURDHfpF/preview.jpg?fit=640x360&t=2023-07-27T00:15:55Z
```

Produces this image:
Expand Down
3 changes: 2 additions & 1 deletion lib/auth.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,11 @@ export function withAuth<Params, Props>(
return async (ctx) => {
const { req } = ctx;
const token = req.cookies['fftoken'];
const dest = ctx.resolvedUrl || req.url || '/';
if (!token || !(await validateFusionFeedToken(token))) {
return {
redirect: {
destination: '/login#destination=' + encodeURIComponent(req.url || '/'),
destination: '/login#destination=' + encodeURIComponent(dest),
permanent: false,
},
};
Expand Down
4 changes: 4 additions & 0 deletions lib/content-loading.ts
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,10 @@ export async function getAllContent(): Promise<Map<string, Content>> {
type: 'mdxJsxAttribute',
name: 'document',
value: document,
}, {
type: 'mdxJsxAttribute',
name: 'version',
value: version,
}];
node.children = [];
},
Expand Down
52 changes: 26 additions & 26 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"dependencies": {
"@emotion/react": "^11.10.6",
"@emotion/server": "^11.10.0",
"@graphiql/react": "^0.19.0",
"@graphiql/react": "^0.19.2",
"@mantine/core": "^5.10.5",
"@mantine/hooks": "^5.10.5",
"@mantine/next": "^5.10.5",
Expand All @@ -25,7 +25,7 @@
"eslint": "8.34.0",
"eslint-config-next": "13.2.1",
"file-saver": "^2.0.5",
"graphiql": "^3.0.1",
"graphiql": "^3.0.4",
"graphql": "^16.6.0",
"graphql-ws": "^5.12.0",
"hast-util-from-html-isomorphic": "^1.0.0",
Expand Down
22 changes: 19 additions & 3 deletions pages/[...path].tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { useRouter } from 'next/router';

import { DefaultPage, Props } from '../components/DefaultPage';
import { withAuth } from '../lib/auth';
import { canonicalContentPath } from '../lib/content';
import { getAllContent, getProductTableOfContents } from '../lib/content-loading';

Expand All @@ -11,7 +10,7 @@ interface Params {
path: string[];
}

export const getServerSideProps = withAuth<Params, Props>(async function ({ params }) {
export const getStaticProps = async function ({ params }: { params: Params }) {
if (!params) {
return { notFound: true };
}
Expand All @@ -36,4 +35,21 @@ export const getServerSideProps = withAuth<Params, Props>(async function ({ para
headings: content.headings,
},
};
});
};

export const getStaticPaths = async function () {
const allContent = await getAllContent();

return {
fallback: false,
paths: Array.from(allContent.keys()).filter((key) => ![
'/',
'/fusionfeed/rest/explorer-and-reference',
'/fusionfeed/graphql/explorer-and-reference',
].includes(key)).map((key) => ({
params: {
path: canonicalContentPath(key).split('/').slice(1),
},
})),
};
};
5 changes: 2 additions & 3 deletions pages/index.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { HomePage, Props } from '../components/HomePage';
import { withAuth } from '../lib/auth';
import { canonicalContentPath, Frontmatter } from '../lib/content';
import { getAllContent } from '../lib/content-loading';

Expand All @@ -23,7 +22,7 @@ interface HomePageFrontmatter extends Frontmatter {
products: ProductFrontmatter[];
}

export const getServerSideProps = withAuth<{}, Props>(async function () {
export const getStaticProps = async function () {
const allContent = await getAllContent();
const content = allContent.get('/')!;
const frontmatter = content.frontmatter as unknown as HomePageFrontmatter;
Expand Down Expand Up @@ -59,4 +58,4 @@ export const getServerSideProps = withAuth<{}, Props>(async function () {
}),
},
};
});
};
Binary file modified public/images/fusionfeed/rest/video-preview-example.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.