forked from clintonwoo/hackernews-react-graphql
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathjobs.tsx
77 lines (68 loc) · 2.15 KB
/
jobs.tsx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
import { useQuery } from '@apollo/react-hooks';
import gql from 'graphql-tag';
import * as React from 'react';
import { NewsFeed, newsFeedNewsItemFragment } from '../src/components/news-feed';
import { withDataAndRouter } from '../src/helpers/with-data';
import { MainLayout } from '../src/layouts/main-layout';
import { FeedType } from '../src/data/models';
import { POSTS_PER_PAGE } from '../src/config';
const query = gql`
query topNewsItems($type: FeedType!, $first: Int!, $skip: Int!) {
feed(type: $type, first: $first, skip: $skip) {
...NewsFeed
}
}
${newsFeedNewsItemFragment}
`;
export interface IJobsPageOwnProps {
options: {
currentUrl: string;
first: number;
isJobListing: boolean;
isRankVisible: boolean;
isUpvoteVisible: boolean;
notice: JSX.Element;
skip: number;
};
}
export function JobsPage(props): JSX.Element {
const { router } = props;
const pageNumber = (router.query && +router.query.p) || 0;
const first = POSTS_PER_PAGE;
const skip = POSTS_PER_PAGE * pageNumber;
const { data } = useQuery(query, { variables: { first, skip, type: FeedType.JOB } });
return (
<MainLayout currentUrl={router.pathname}>
<NewsFeed
currentUrl={router.pathname}
data={data}
first={POSTS_PER_PAGE}
isJobListing
isRankVisible={false}
isUpvoteVisible={false}
notice={
<>
<tr key="noticetopspacer" style={{ height: '20px' }} />
<tr key="notice">
<td />
<td>
<img alt="" src="/static/s.gif" height="1" width="14" />
</td>
<td>
These are jobs at startups that were funded by Y Combinator. You can also get a job
at a YC startup through{' '}
<a href="https://triplebyte.com/?ref=yc_jobs">
<u>Triplebyte</u>
</a>
.
</td>
</tr>
<tr key="noticebottomspacer" style={{ height: '20px' }} />
</>
}
skip={POSTS_PER_PAGE * pageNumber}
/>
</MainLayout>
);
}
export default withDataAndRouter(JobsPage);