Update Our Status tags
This commit is contained in:
parent
5d0d9813cf
commit
14bf618c84
|
@ -56,6 +56,11 @@ Home.getInitialProps = async (
|
|||
data: { },
|
||||
})
|
||||
);
|
||||
await ctx.store.dispatch(
|
||||
HomeActions.GetStatusData({
|
||||
data: { },
|
||||
})
|
||||
);
|
||||
await ctx.store.dispatch(
|
||||
HomeActions.GetNimbusData({
|
||||
data: { },
|
||||
|
|
|
@ -50,33 +50,4 @@ describe("Home action tests", () => {
|
|||
|
||||
expect(store.getActions()).toEqual(expectedActions);
|
||||
});
|
||||
|
||||
test("GetApod test", async () => {
|
||||
const store = mockStore({});
|
||||
|
||||
const expectedActions = [
|
||||
{
|
||||
payload: {
|
||||
image: {
|
||||
copyright: "Pankod",
|
||||
date: "2019-05-23",
|
||||
explanation: "",
|
||||
hdurl: "",
|
||||
media_type: "",
|
||||
service_version: "",
|
||||
title: "",
|
||||
url: "",
|
||||
},
|
||||
},
|
||||
type: ActionConsts.Home.SetReducer,
|
||||
},
|
||||
];
|
||||
|
||||
// eslint-disable-next-line
|
||||
await store.dispatch<any>(
|
||||
HomeActions.GetApod({ params: { hd: true } })
|
||||
);
|
||||
|
||||
expect(store.getActions()).toEqual(expectedActions);
|
||||
});
|
||||
});
|
||||
|
|
|
@ -17,11 +17,15 @@ var parseString = require('xml2js').parseString;
|
|||
const CORS_PROXY = "https://cors-fix.status.im/";
|
||||
|
||||
const embarkBlog = "https://blog.embarklabs.io/atom.xml";
|
||||
const embarkOldBlog = "https://framework.embarklabs.io/atom.xml";
|
||||
|
||||
const nimbusBlog = "https://our.status.im/ghost/api/v2/content/posts/?key=10e7f8c1f793d2945ea1177076&filter=tag:nim&limit=all&include=authors";
|
||||
const statusBlog = "https://our.status.im/ghost/api/v2/content/posts/?key=10e7f8c1f793d2945ea1177076&filter=tag:tutorial-status&limit=all&include=authors";
|
||||
|
||||
const subspaceBlog = "https://our.status.im/ghost/api/v2/content/posts/?key=10e7f8c1f793d2945ea1177076&filter=tag:subspace&limit=all&include=authors";
|
||||
const nimbusBlog = "https://our.status.im/ghost/api/v2/content/posts/?key=10e7f8c1f793d2945ea1177076&filter=tag:tutorial-nimbus&limit=all&include=authors";
|
||||
|
||||
const subspaceBlog = "https://our.status.im/ghost/api/v2/content/posts/?key=10e7f8c1f793d2945ea1177076&filter=tag:tutorial-subspace&limit=all&include=authors";
|
||||
|
||||
let statusData: any = '';
|
||||
let parsedStatusData:any = [];
|
||||
|
||||
let embarkData: any = '';
|
||||
let parsedEmbarkData:any = [];
|
||||
|
@ -32,6 +36,15 @@ let parsedNimbusData:any = [];
|
|||
let subspaceData: any = '';
|
||||
let parsedSubspaceData:any = [];
|
||||
|
||||
interface StatusBlog {
|
||||
title: string;
|
||||
published_at: string;
|
||||
primary_author: any;
|
||||
excerpt: string;
|
||||
feature_image: string;
|
||||
url: string;
|
||||
}
|
||||
|
||||
interface NimbusBlog {
|
||||
title: string;
|
||||
published_at: string;
|
||||
|
@ -73,29 +86,22 @@ export const FetchEmbark = async () => {
|
|||
})
|
||||
}
|
||||
|
||||
export const FetchOldEmbark = async () => {
|
||||
await fetch(`${CORS_PROXY}`+ `${embarkOldBlog}`)
|
||||
.then(response => response.text())
|
||||
export const FetchStatus = async () => {
|
||||
await fetch(`${CORS_PROXY}`+ `${statusBlog}`)
|
||||
.then(response => response.json())
|
||||
.then(data => {
|
||||
embarkData = data
|
||||
parseString(embarkData, function (err:any, result:any) {
|
||||
const entries: Array<any> = result.feed.entry;
|
||||
entries.forEach(entry => {
|
||||
const category = entry.category[0]['$']['term']
|
||||
const title = entry.title[0];
|
||||
const checkDuplicate = title == "How to upgrade to Embark 4" || title == "Introduction to Web3 - What Are Your Options?" ||
|
||||
title.includes("Nim vs Crystal")
|
||||
if (category === 'tutorials' && !checkDuplicate) {
|
||||
const postData: any = {}
|
||||
postData.title = entry.title[0];
|
||||
postData.published = entry.published[0];
|
||||
postData.url = entry.id[0];
|
||||
postData.summary = entry.summary[0]._;
|
||||
parsedEmbarkData.push(postData)
|
||||
}
|
||||
})
|
||||
});
|
||||
});
|
||||
statusData = data.posts
|
||||
statusData.forEach((entry: StatusBlog) => {
|
||||
const postData: any = {}
|
||||
postData.title = entry.title;
|
||||
postData.published_at = entry.published_at;
|
||||
postData.excerpt = entry.excerpt;
|
||||
postData.author = entry.primary_author.name;
|
||||
postData.feature_image = entry.feature_image;
|
||||
postData.url = entry.url;
|
||||
parsedStatusData.push(postData);
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
export const FetchNimbus = async () => {
|
||||
|
@ -157,6 +163,19 @@ export const HomeActions = {
|
|||
parsedEmbarkData = []
|
||||
},
|
||||
|
||||
GetStatusData: (payload: IHomePage.Actions.NimbusData) => async (
|
||||
dispatch: Dispatch
|
||||
) => {
|
||||
await FetchStatus();
|
||||
dispatch({
|
||||
payload: {
|
||||
statusData: parsedStatusData,
|
||||
},
|
||||
type: ActionConsts.Home.SetReducer,
|
||||
});
|
||||
parsedStatusData = []
|
||||
},
|
||||
|
||||
GetNimbusData: (payload: IHomePage.Actions.NimbusData) => async (
|
||||
dispatch: Dispatch
|
||||
) => {
|
||||
|
|
|
@ -9,8 +9,6 @@ const Embark = () => {
|
|||
let loadedAll = false;
|
||||
if (embarkData) {
|
||||
loadedAll = embarkData.length !== 0
|
||||
|
||||
console.log(embarkData)
|
||||
}
|
||||
|
||||
return loadedAll ? (
|
||||
|
|
|
@ -4,7 +4,15 @@ import { IStore } from "@Redux/IStore";
|
|||
|
||||
const Status = () => {
|
||||
|
||||
return (
|
||||
const home = useSelector((state: IStore) => state.home);
|
||||
const statusData: any = home.statusData;
|
||||
|
||||
let loadedAll = false;
|
||||
if (statusData) {
|
||||
loadedAll = statusData.length !== 0
|
||||
}
|
||||
|
||||
return loadedAll ? (
|
||||
<>
|
||||
<section className="news-list">
|
||||
<div className="container">
|
||||
|
@ -26,21 +34,23 @@ const Status = () => {
|
|||
<div className="description" style={{ paddingRight: '10px' }}>Status-go is an underlying part of Status depending on go-ethereum which is forked and modified by us.</div>
|
||||
</div>
|
||||
</li>
|
||||
<li key="3">
|
||||
<div className="post">
|
||||
<div className="meta"><a href="https://status.im/">Status</a></div>
|
||||
<h4 ><a className="post-title" href="https://our.status.im/reproducable-builds-with-nix/">Reproducible Builds with Nix</a></h4>
|
||||
<div className="author" style={{ paddingRight: '10px' }}>By <div className="author-name">Jakub Sokołowski</div></div>
|
||||
<div className="description" style={{ paddingRight: '10px' }}>Nix is a tool which uses a subset of Haskel programming language to define the entire tree of software dependencies necessary to manage an entire Linux operating system: NixOS.</div>
|
||||
</div>
|
||||
</li>
|
||||
{statusData.map((data: { url: string ; title: string; published_at: string; excerpt: string; author: string;}, i: any) => (
|
||||
<li key={i + 2}>
|
||||
<div className="post">
|
||||
<div className="meta"><time>{data.published_at.substring(0,10)}</time> / <a href="https://nimbus.team/">Nimbus</a></div>
|
||||
<h4 ><a className="post-title" href={data.url}>{data.title}</a></h4>
|
||||
<div className="author" style={{ paddingRight: '10px' }}>By <div className="author-name">{data.author}</div></div>
|
||||
<div className="description" style={{ paddingRight: '10px' }}>{data.excerpt}</div>
|
||||
</div>
|
||||
</li>
|
||||
))}
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
</>
|
||||
)
|
||||
) : null
|
||||
}
|
||||
|
||||
export default Status;
|
|
@ -16,6 +16,9 @@ declare namespace IHomePage {
|
|||
image: {
|
||||
url: string;
|
||||
};
|
||||
statusData: {
|
||||
data: Array<any>;
|
||||
};
|
||||
embarkData: {
|
||||
data: Array<any>;
|
||||
};
|
||||
|
@ -33,6 +36,10 @@ declare namespace IHomePage {
|
|||
|
||||
export interface IMapResponse {}
|
||||
|
||||
export interface StatusData {
|
||||
data: {};
|
||||
}
|
||||
|
||||
export interface EmbarkData {
|
||||
data: {};
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue