Skip to content

Commit 8fa3fe6

Browse files
committed
changed in-article to in-feed ads
1 parent 63f5462 commit 8fa3fe6

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

81 files changed

+11496
-11496
lines changed

.gitignore

+41-41
Original file line numberDiff line numberDiff line change
@@ -1,42 +1,42 @@
1-
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
2-
3-
# dependencies
4-
/node_modules
5-
/.pnp
6-
.pnp.js
7-
8-
# testing
9-
/coverage
10-
11-
# next.js
12-
/.next/
13-
/out/
14-
15-
**/public/workbox-*.js
16-
**/public/sw.js
17-
**/public/fallback-*.js
18-
19-
# production
20-
/build
21-
22-
# misc
23-
.DS_Store
24-
*.pem
25-
26-
# debug
27-
npm-debug.log*
28-
yarn-debug.log*
29-
yarn-error.log*
30-
31-
# local env files
32-
.env.local
33-
.env.development.local
34-
.env.test.local
35-
.env.production.local
36-
37-
# vercel
38-
.vercel
39-
40-
# sitemaps
41-
/public/robots.txt
1+
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
2+
3+
# dependencies
4+
/node_modules
5+
/.pnp
6+
.pnp.js
7+
8+
# testing
9+
/coverage
10+
11+
# next.js
12+
/.next/
13+
/out/
14+
15+
**/public/workbox-*.js
16+
**/public/sw.js
17+
**/public/fallback-*.js
18+
19+
# production
20+
/build
21+
22+
# misc
23+
.DS_Store
24+
*.pem
25+
26+
# debug
27+
npm-debug.log*
28+
yarn-debug.log*
29+
yarn-error.log*
30+
31+
# local env files
32+
.env.local
33+
.env.development.local
34+
.env.test.local
35+
.env.production.local
36+
37+
# vercel
38+
.vercel
39+
40+
# sitemaps
41+
/public/robots.txt
4242
/public/sitemap.xml

README.md

+34-34
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,34 @@
1-
This is a [Next.js](https://nextjs.org/) project bootstrapped with [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app).
2-
3-
## Getting Started
4-
5-
First, run the development servers
6-
7-
```bash
8-
npm run dev
9-
# or
10-
yarn dev
11-
```
12-
13-
Open [https://wpcodevo.com](https://wpcodevo.com) with your browser to see the result.
14-
15-
You can start editing the page by modifying `pages/index.js`. The page auto-updates as you edit the file.
16-
17-
[API routes](https://nextjs.org/docs/api-routes/introduction) can be accessed on [http://localhost:3000/api/hello](http://localhost:3000/api/hello). This endpoint can be edited in `pages/api/hello.js`.
18-
19-
The `pages/api` directory is mapped to `/api/*`. Files in this directory are treated as [API routes](https://nextjs.org/docs/api-routes/introduction) instead of React pages.
20-
21-
## Learn More
22-
23-
To learn more about Next.js, take a look at the following resources:
24-
25-
- [Next.js Documentation](https://nextjs.org/docs) - learn about Next.js features and API.
26-
- [Learn Next.js](https://nextjs.org/learn) - an interactive Next.js tutorial.
27-
28-
You can check out [the Next.js GitHub repository](https://github.com/vercel/next.js/) - your feedback and contributions are welcome!
29-
30-
## Deploy on Vercel
31-
32-
The easiest way to deploy your Next.js app is to use the [Vercel Platform](https://vercel.com/new?utm_medium=default-template&filter=next.js&utm_source=create-next-app&utm_campaign=create-next-app-readme) from the creators of Next.js.
33-
34-
Check out our [Next.js deployment documentation](https://nextjs.org/docs/deployment) for more details.
1+
This is a [Next.js](https://nextjs.org/) project bootstrapped with [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app).
2+
3+
## Getting Started
4+
5+
First, run the development servers
6+
7+
```bash
8+
npm run dev
9+
# or
10+
yarn dev
11+
```
12+
13+
Open [https://wpcodevo.com](https://wpcodevo.com) with your browser to see the result.
14+
15+
You can start editing the page by modifying `pages/index.js`. The page auto-updates as you edit the file.
16+
17+
[API routes](https://nextjs.org/docs/api-routes/introduction) can be accessed on [http://localhost:3000/api/hello](http://localhost:3000/api/hello). This endpoint can be edited in `pages/api/hello.js`.
18+
19+
The `pages/api` directory is mapped to `/api/*`. Files in this directory are treated as [API routes](https://nextjs.org/docs/api-routes/introduction) instead of React pages.
20+
21+
## Learn More
22+
23+
To learn more about Next.js, take a look at the following resources:
24+
25+
- [Next.js Documentation](https://nextjs.org/docs) - learn about Next.js features and API.
26+
- [Learn Next.js](https://nextjs.org/learn) - an interactive Next.js tutorial.
27+
28+
You can check out [the Next.js GitHub repository](https://github.com/vercel/next.js/) - your feedback and contributions are welcome!
29+
30+
## Deploy on Vercel
31+
32+
The easiest way to deploy your Next.js app is to use the [Vercel Platform](https://vercel.com/new?utm_medium=default-template&filter=next.js&utm_source=create-next-app&utm_campaign=create-next-app-readme) from the creators of Next.js.
33+
34+
Check out our [Next.js deployment documentation](https://nextjs.org/docs/deployment) for more details.

actions/Pagination.js

+79-79
Original file line numberDiff line numberDiff line change
@@ -1,79 +1,79 @@
1-
import { useSWRInfinite } from "swr";
2-
import { getBlogs } from "actions";
3-
4-
export const useGetBlogsPages = ({ category, filter }) => {
5-
const result = useSWRInfinite((index, previousPageData) => {
6-
if (index === 0) {
7-
return `/api/blogs?date=${
8-
filter.date.asc ? "asc" : "desc"
9-
}&category=${category}`;
10-
}
11-
12-
if (!previousPageData.length) {
13-
return null;
14-
}
15-
16-
return `/api/blogs?offset=${index * 6}&date=${
17-
filter.date.asc ? "asc" : "desc"
18-
}&category=${category}`;
19-
}, getBlogs);
20-
21-
let hitEnd = false;
22-
const { data } = result;
23-
24-
if (data) {
25-
hitEnd = data[data.length - 1].length === 0;
26-
}
27-
28-
return { ...result, hitEnd };
29-
};
30-
31-
export const useGetBlogs = ({ filter }) => {
32-
const result = useSWRInfinite((index, previousPageData) => {
33-
if (index === 0) {
34-
return `/api/allblogs?date=${filter.date.asc ? "asc" : "desc"}`;
35-
}
36-
37-
if (!previousPageData.length) {
38-
return null;
39-
}
40-
41-
return `/api/allblogs?offset=${index * 10}&date=${
42-
filter.date.asc ? "asc" : "desc"
43-
}`;
44-
}, getBlogs);
45-
46-
let hitEnd = false;
47-
const { data } = result;
48-
49-
if (data) {
50-
hitEnd = data[data.length - 1].length === 0;
51-
}
52-
53-
return { ...result, hitEnd };
54-
};
55-
56-
export const useGetSearchBlogs = ({ filter, query }) => {
57-
const result = useSWRInfinite((index, previousPageData) => {
58-
if (index === 0) {
59-
return `/api/search?date=${filter.date.asc ? "asc" : "desc"}&q=${query}`;
60-
}
61-
62-
if (!previousPageData.length) {
63-
return null;
64-
}
65-
66-
return `/api/search?offset=${index * 10}&date=${
67-
filter.date.asc ? "asc" : "desc"
68-
}&q=${query}`;
69-
}, getBlogs);
70-
71-
let hitEnd = false;
72-
const { data } = result;
73-
74-
if (data) {
75-
hitEnd = data[data.length - 1].length === 0;
76-
}
77-
78-
return { ...result, hitEnd };
79-
};
1+
import { useSWRInfinite } from "swr";
2+
import { getBlogs } from "actions";
3+
4+
export const useGetBlogsPages = ({ category, filter }) => {
5+
const result = useSWRInfinite((index, previousPageData) => {
6+
if (index === 0) {
7+
return `/api/blogs?date=${
8+
filter.date.asc ? "asc" : "desc"
9+
}&category=${category}`;
10+
}
11+
12+
if (!previousPageData.length) {
13+
return null;
14+
}
15+
16+
return `/api/blogs?offset=${index * 6}&date=${
17+
filter.date.asc ? "asc" : "desc"
18+
}&category=${category}`;
19+
}, getBlogs);
20+
21+
let hitEnd = false;
22+
const { data } = result;
23+
24+
if (data) {
25+
hitEnd = data[data.length - 1].length === 0;
26+
}
27+
28+
return { ...result, hitEnd };
29+
};
30+
31+
export const useGetBlogs = ({ filter }) => {
32+
const result = useSWRInfinite((index, previousPageData) => {
33+
if (index === 0) {
34+
return `/api/allblogs?date=${filter.date.asc ? "asc" : "desc"}`;
35+
}
36+
37+
if (!previousPageData.length) {
38+
return null;
39+
}
40+
41+
return `/api/allblogs?offset=${index * 10}&date=${
42+
filter.date.asc ? "asc" : "desc"
43+
}`;
44+
}, getBlogs);
45+
46+
let hitEnd = false;
47+
const { data } = result;
48+
49+
if (data) {
50+
hitEnd = data[data.length - 1].length === 0;
51+
}
52+
53+
return { ...result, hitEnd };
54+
};
55+
56+
export const useGetSearchBlogs = ({ filter, query }) => {
57+
const result = useSWRInfinite((index, previousPageData) => {
58+
if (index === 0) {
59+
return `/api/search?date=${filter.date.asc ? "asc" : "desc"}&q=${query}`;
60+
}
61+
62+
if (!previousPageData.length) {
63+
return null;
64+
}
65+
66+
return `/api/search?offset=${index * 10}&date=${
67+
filter.date.asc ? "asc" : "desc"
68+
}&q=${query}`;
69+
}, getBlogs);
70+
71+
let hitEnd = false;
72+
const { data } = result;
73+
74+
if (data) {
75+
hitEnd = data[data.length - 1].length === 0;
76+
}
77+
78+
return { ...result, hitEnd };
79+
};

actions/index.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
const fetcher = (url) => fetch(url).then((res) => res.json());
2-
3-
export const getBlogs = (url) => fetcher(url);
1+
const fetcher = (url) => fetch(url).then((res) => res.json());
2+
3+
export const getBlogs = (url) => fetcher(url);

0 commit comments

Comments
 (0)