Skip to content

Commit

Permalink
Merge pull request #27 from tiny-factories/preview
Browse files Browse the repository at this point in the history
Changed name to Earth Directory and fixed some spelling.
  • Loading branch information
gndclouds authored Oct 26, 2023
2 parents 26c22ad + 56f5082 commit 104287a
Show file tree
Hide file tree
Showing 8 changed files with 68 additions and 32 deletions.
2 changes: 1 addition & 1 deletion .nova/Configuration.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
"workspace.name" : "glossary-mfe"
"workspace.name" : "earth-directory"
}
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
# Climate Glossary
# Earth Directory

[![wakatime](https://wakatime.com/badge/user/dd7ed260-af32-43f0-bd89-496e1d7ed257/project/d24a3db6-6593-4e63-af4d-ecfd2d86b596.svg)](https://wakatime.com/badge/user/dd7ed260-af32-43f0-bd89-496e1d7ed257/project/d24a3db6-6593-4e63-af4d-ecfd2d86b596)

A shared source of truth to build a better future. As awareness of the climate crysis increases, so does the
noise and origin of informaiton. We are working to make a glossary of terms, agreements, companies,
orginizations and more.
A shared source of truth to build a better future. As awareness of the climate crisis increases, so does the
noise and origin of information. We are working to make a glossary of terms, agreements, companies,
organizations and more.

[Submit a Term](https://form.typeform.com/to/lowIfjl5) or [Help Translate](https://form.typeform.com/to/hV9yuh6J)
2 changes: 1 addition & 1 deletion components/Footer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ const navigation = {
},
{
name: "gitHub",
href: "https://github.com/tiny-factories/mfe-climate-glossary",
href: "https://github.com/tiny-factories/mfe-glossary",
},
],
};
Expand Down
10 changes: 5 additions & 5 deletions components/Layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ const Layout: React.FC<Props> = (props) => {
const [search, setSearch] = useState<string | null>(null);
const [loading, setLoading] = useState(false);

let title = "Climate Glossary MFE";
let title = "Earth Directory";

const debouncedSearch = useDebounce(search, 500);

Expand All @@ -65,11 +65,11 @@ const Layout: React.FC<Props> = (props) => {
<Head>
{process.env.UMAMI != "DEVELOPMENT" ? (
<>
<title>Climate Glossary [PREVIEW]</title>
<title>Earth Directory [PREVIEW]</title>
</>
) : (
<>
<title>Climate Glossary</title>
<title>Earth Directory</title>
</>
)}
<meta name="viewport" content="initial-scale=1.0, width=device-width" />
Expand All @@ -89,8 +89,8 @@ const Layout: React.FC<Props> = (props) => {
<div className="flex">
<div className="flex flex-shrink-0 items-center">
<Link href="/">
<div className="font-bold hover:underline hover:underline-offset-4 hover:decoration-2 uppercase pl-4 pr-2 py-2">
Glossary
<div className="font-bold hover:underline hover:underline-offset-4 hoveßr:decoration-2 uppercase pl-4 pr-2 py-2">
Earth Directory
</div>
</Link>
</div>
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name": "glossary-made-for-earth",
"name": "earth-directory",
"version": "1.0.0",
"description": "A shared source of truth to build a better future.",
"license": "CC0 1.0 Universal",
Expand Down
Binary file modified pages/.DS_Store
Binary file not shown.
41 changes: 30 additions & 11 deletions pages/terms/[id]/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,10 @@ const TermPage: React.FC<TermProps> = (props) => {
<div className="text-h4 sm:text-h3 md:sm:text-h1 font-bold font-satoshi border-b-2">
{title}
</div>
<div className="grid grid-cols-4 py-9">
{/* Section Definition */}
<div className="grid grid-cols-4 gap-4 gap-4 py-9">
<div className="col-span-4 md:col-span-1 pb-9">
<div className="text-h5 md:text-h3 font-bold">Overview</div>
<div className="text-h5 md:text-h3 font-bold">Definition</div>
<div className="">
via{" "}
<Link href={props.pageData.source.href} className="underline">
Expand All @@ -45,13 +46,32 @@ const TermPage: React.FC<TermProps> = (props) => {
{props?.pageData.content || "Undefinded Term"}
</div>
</div>

{/* Section Simple Example */}
<div>
{" "}
{/* <div className="grid grid-cols-4 py-9">
<div className="grid grid-cols-4 gap-4 py-9">
<div className="col-span-4 md:col-span-1 pb-9">
<div className="text-h5 md:text-h3 font-bold">Example</div>
<div className="">
via{" "}
<Link
href={`/source/${props.sourceId}`}
className="underline"
>
source
</Link>
</div>
</div>
<div className="col-span-4 md:col-span-3 text-h4 sm:text-h3 md:sm:text-h2 italic">
Coming Soon
</div>
</div>
</div>
{/* Section Case Case Studies */}
<div>
<div className="grid grid-cols-4 gap-4 py-9">
<div className="col-span-4 md:col-span-1 pb-9">
<div className="text-h5 md:text-h3 font-bold">The Details</div>
{/* <div className="">
<div className="text-h5 md:text-h3 font-bold">Case Studies</div>
<div className="">
via{" "}
<Link
href={`/source/${props.sourceId}`}
Expand All @@ -64,12 +84,13 @@ const TermPage: React.FC<TermProps> = (props) => {
<div className="col-span-4 md:col-span-3 text-h4 sm:text-h3 md:sm:text-h2 italic">
Coming Soon
</div>
</div> */}
</div>
</div>
{/* Section on Related Terms */}

<div>
{" "}
<div className="grid grid-cols-4 py-9">
<div className="grid grid-cols-4 gap-4 py-9">
<div className="col-span-4 md:col-span-1 pb-9">
<div className="text-h5 md:text-h3 font-bold">
Related Terms
Expand Down Expand Up @@ -121,8 +142,6 @@ const TermPage: React.FC<TermProps> = (props) => {
</div>
</div>
</div>

<div></div>
</div>
</Layout>
</>
Expand Down
35 changes: 26 additions & 9 deletions pages/terms/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,12 @@ type Props = {
};

const Home: React.FC<Props> = (props) => {
function getRandomTerm(terms) {
if (!terms || terms.length === 0) return "N/A";
const today = new Date().getDate();
return terms[today % terms.length].title;
}

return (
<Layout>
<div className="hidden sm:flex flex-wrap w-full justify-between hover:bold">
Expand Down Expand Up @@ -40,12 +46,11 @@ const Home: React.FC<Props> = (props) => {
))}
</div>
</div>

<div className="page">
<main className="snap-y">
<div className="">
{props.result
.sort(function (a, b) {
.sort((a, b) => {
if (a.group < b.group) {
return -1;
}
Expand All @@ -55,16 +60,18 @@ const Home: React.FC<Props> = (props) => {
return 0;
})
.map((term, i) => (
<div className="" key={i}>
<div className="" key={term.id || i}>
<div
id={term.group}
className="text-h4 sm:text-h3 md:sm:text-h2 font-bold text-gray-500 font-satoshi"
>
{term.group}{" "}
<span className="text-[#918180]">is for {term.group}</span>
<span className="text-[#918180]">
is for {term.randomTerm}
</span>
</div>
{term.children
.sort(function (a, b) {
.sort((a, b) => {
if (a.group < b.group) {
return -1;
}
Expand All @@ -74,15 +81,15 @@ const Home: React.FC<Props> = (props) => {
return 0;
})
.map((term, i) => (
<div key={i} className="">
<div key={term.id || i} className="">
<Term term={term} />
</div>
))}
</div>
))}
</div>
</main>
</div>
</div>{" "}
</Layout>
);
};
Expand All @@ -96,11 +103,21 @@ export const getStaticProps: GetStaticProps = async () => {

let data = feed.reduce((r, e) => {
let group = e.title[0];
if (!r[group]) r[group] = { group, children: [e] };
else r[group].children.push(e);
if (!r[group]) {
r[group] = { group, children: [e] };
} else {
r[group].children.push(e);
}
return r;
}, {});

// Now, assign a random term for each group
for (let group in data) {
const terms = data[group].children;
const randomIndex = Math.floor(Math.random() * terms.length);
data[group].randomTerm = terms[randomIndex].title;
}

let result = Object.values(data);

return {
Expand Down

1 comment on commit 104287a

@vercel
Copy link

@vercel vercel bot commented on 104287a Oct 26, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.