-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ANW2-18 replace airtable with feeds api and link logo to homepage
Signed-off-by: Greg Osuri <[email protected]>
- Loading branch information
Showing
5 changed files
with
76 additions
and
65 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
1658277144 | ||
1658953195 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
deployment: | ||
web: | ||
dcloud: | ||
count: 1 | ||
profile: web | ||
profiles: | ||
compute: | ||
web: | ||
resources: | ||
cpu: | ||
units: 0.5 | ||
memory: | ||
size: 512Mi | ||
storage: | ||
size: 512Mi | ||
placement: | ||
dcloud: | ||
attributes: | ||
host: akash | ||
pricing: | ||
web: | ||
amount: 1000 | ||
denom: uakt | ||
signedBy: | ||
anyOf: | ||
- akash1365yvmc4s7awdyj3n2sav7xfx76adc6dnmlx63 | ||
services: | ||
web: | ||
expose: | ||
- accept: | ||
- ecosystem.akash.network | ||
as: 80 | ||
port: 3000 | ||
to: | ||
- global: true | ||
image: ghcr.io/gosuri/akash-ecosystem:1658953195 | ||
version: "2.0" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,75 +1,35 @@ | ||
import { useState } from "react"; | ||
import cacheData from "memory-cache"; | ||
const ecosystemEndpoint = "http://feeds.akash.network/ecosystem"; | ||
|
||
const endpoint = "https://api.airtable.com/v0/appHcQU9gd0RCCeJS"; | ||
const apikey = "keyZLM4ZzL3PgPQyQ"; // Readonly Key as Artable lacks support for public APIs. Dont get cute ideas. | ||
|
||
const projectsEndpoint = `${endpoint}/Projects?api_key=${apikey}`; | ||
const tweetsEndpoint = `${endpoint}/Tweets?api_key=${apikey}`; | ||
const videosEndpoint = `${endpoint}/Videos?api_key=${apikey}`; | ||
|
||
|
||
function makeProject(record) { | ||
let name = record.fields["Name"]; | ||
let id = name.trim().toLowerCase().replaceAll(' ', '-'); | ||
let category = record.fields["Category"]; | ||
let description = record.fields["Description"]; | ||
let logo_square = `https://picsum.photos/seed/${category}/400/400`; | ||
|
||
if (record.fields["Logo Square"].length > 0 ) { | ||
logo_square = record.fields["Logo Square"][0].url; | ||
} | ||
|
||
return { | ||
id: id, | ||
name: name, | ||
category: category, | ||
logo_square: logo_square, | ||
description: description, | ||
export async function getEcosystemData() { | ||
let response = await fetch(ecosystemEndpoint); | ||
let data = await response.json(); | ||
if (data && data["projects"].length > 0) { | ||
return data["projects"] | ||
} | ||
} | ||
|
||
export async function getProjectsData() { | ||
var projects = cacheData.get("projects"); | ||
if (projects == undefined) { | ||
console.log("projects is null") | ||
projects = []; | ||
} | ||
console.log("projects.length: ", projects.length) | ||
|
||
if (projects.length > 0) { return projects }; | ||
console.log("fetching: " + projectsEndpoint); | ||
const res = await fetch(projectsEndpoint); | ||
const data = await res.json(); | ||
//console.log(data.records); | ||
data.records.map((record) => { | ||
projects.push(makeProject(record)) | ||
}); | ||
//console.log(projects) | ||
cacheData.put("projects", projects); | ||
return projects; | ||
} | ||
|
||
export async function getProjectIDs() { | ||
const dat = await getProjectsData(); | ||
const dat = await getEcosystemData(); | ||
return dat.map((item) => { | ||
return { | ||
params: { | ||
id: item.id, | ||
id: item.slug, | ||
}, | ||
}; | ||
}); | ||
} | ||
|
||
export async function getProjectData(id) { | ||
const dat = await getProjectsData(); | ||
export async function getProjectData(slug) { | ||
const dat = await getEcosystemData(); | ||
let result = ""; | ||
dat.map((item) => { | ||
if (item.id === id) { | ||
result = item | ||
dat.map((project) => { | ||
if (project.slug === slug) { | ||
result = project | ||
return | ||
} | ||
}); | ||
console.log("getting project: " + result.name) | ||
console.log("fetching project: " + result.name) | ||
return result; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters