Skip to content

Commit

Permalink
šŸŖ¢ Merge #29 (stagingā†dev)
Browse files Browse the repository at this point in the history
šŸ”§ Refactor: Add Header. Implement middleware. Fix minor bugs
  • Loading branch information
danielbakas authored Dec 23, 2023
2 parents 0941e48 + c6bec7d commit c3e0a5a
Show file tree
Hide file tree
Showing 48 changed files with 746 additions and 103 deletions.
10 changes: 6 additions & 4 deletions jsconfig.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
{
"compilerOptions": {
"paths": {
"@/*": ["./src/*"]
}
"compilerOptions": {
"paths": {
"@semantyk/*": [
"./src/*"
]
}
}
}
44 changes: 44 additions & 0 deletions src/app/[slug]/page.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
/*
* ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“
* # `page.jsx`
* client | Semantyk
*
* Created: Nov 30, 2023
* Modified: Dec 22, 2023
*
* Author(s): Semantyk Team
* Maintainer(s): Daniel Bakas <https://id.danielbakas.com>
*
* Copyright Ā© Semantyk 2023. All rights reserved.
* ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“
*/

//* Imports
import React from "react";
//* Local Imports
import "@semantyk/app/page.css";
import Page from "@semantyk/app/page";
import { getPage } from "@semantyk/frontend/logic/services/getPage";
import {
getKnowledge
} from "@semantyk/backend/api/knowledge/services/getKnowledge";

//* Metadata
export async function generateMetadata({ params }) {
const { slug } = params;
try {
const { title, subtitle } = await getPage(slug);
// TODO: Remove when Template description is added to Next.js
const { slogan } = await getKnowledge(fetch);
const description = `${slogan} | ${subtitle}`;
return { title, description };
} catch (e) {
console.log(`Error: ${slug} does not exist`);
}
}

//* Main
export default function DynamicPage(props) {
// Return
return <Page {...props}/>;
}
23 changes: 23 additions & 0 deletions src/app/layout.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
/*
* ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“
* # `layout.css`
* client | Semantyk
*
* Created: Dec 23, 2023
* Modified: Dec 23, 2023
*
* Author(s): Semantyk Team
* Maintainer(s): Daniel Bakas <https://id.danielbakas.com>
*
* Copyright Ā© Semantyk 2023. All rights reserved.
* ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“
*/

/* Imports */
@import 'bootstrap/dist/css/bootstrap.min.css';

/* Main */
#App {
padding-left: 1rem;
padding-right: 1rem;
}
18 changes: 10 additions & 8 deletions src/app/layout.jsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
/*
* ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“
* # `layout.jsx` | `app`
* # `layout.jsx`
* client | Semantyk
*
* Created: Nov 30, 2023
* Modified: Dec 10, 2023
* Modified: Dec 22, 2023
*
* Author(s): Semantyk Team
* Maintainer(s): Daniel Bakas <https://id.danielbakas.com>
Expand All @@ -14,11 +14,12 @@
*/

//* Imports
import "bootstrap/dist/css/bootstrap.min.css";
import React from "react";
//* Local Imports
import { getMetadata } from "@/backend/logic/seo";
import StateManager from "@/frontend/logic/state";
import "@semantyk/app/layout.css";
import { getMetadata } from "@semantyk/backend/logic/seo";
import SessionProvider from "@semantyk/frontend/logic/SessionProvider";
import Footer from "@semantyk/frontend/ui/components/molecules/Footer";


//* Main
Expand All @@ -28,10 +29,11 @@ export default function RootLayout({ children }) {
// Return
return (
<html lang="en">
<body className={`bg-dark text-light`}>
<StateManager>
<body id="App" className={"bg-dark text-light"}>
<SessionProvider>
{children}
</StateManager>
<Footer/>
</SessionProvider>
</body>
</html>
);
Expand Down
7 changes: 4 additions & 3 deletions src/app/layout.test.jsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
/*
* ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“
* # `layout.test.jsx` | `app`
* # `layout.test.jsx`
* client | Semantyk
*
* Created: Nov 30, 2023
* Modified: Nov 5, 2023
* Modified: Dec 22, 2023
*
* Author(s): Semantyk Team
* Maintainer(s): Daniel Bakas <https://id.danielbakas.com>
Expand All @@ -17,7 +17,8 @@
// layout.test.jsx
import React from "react";
import { render } from "@testing-library/react";
import RootLayout from "./layout";
import RootLayout from "@semantyk/app/layout";


describe("Root Layout", () => {
it("should render", () => {
Expand Down
6 changes: 3 additions & 3 deletions src/app/not-found.jsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
/*
* ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“
* # `not-found.jsx` | `app`
* # `not-found.jsx`
* client | Semantyk
*
* Created: Dec 06, 2023
* Modified: Dec 06, 2023
* Modified: Dec 22, 2023
*
* Author(s): Semantyk Team
* Maintainer(s): Daniel Bakas <https://id.danielbakas.com
Expand All @@ -14,7 +14,7 @@
*/

//* Imports
import Page from "./page";
import Page from "@semantyk/app/page";

//* Main
export default function NotFound() {
Expand Down
11 changes: 3 additions & 8 deletions src/app/page.css
Original file line number Diff line number Diff line change
@@ -1,19 +1,14 @@
/*
* ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“
* # `page.css` | 'app'
* # `page.css`
* client | Semantyk
*
* Created: Nov 30, 2023
* Modified: Dec 10, 2023
* Modified: Dec 22, 2023
*
* Author(s): Semantyk Team
* Maintainer(s): Daniel Bakas <https://id.danielbakas.com>
*
* Copyright Ā© Semantyk 2023. All rights reserved.
* ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“
*/

#Page {
/* px-3 */
padding: 1rem;
}
*/
13 changes: 7 additions & 6 deletions src/app/page.jsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
/*
* ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“
* # `page.jsx` | `app`
* # `page.css.jsx`
* client | Semantyk
*
* Created: Nov 30, 2023
* Modified: Dec 10, 2023
* Modified: Dec 22, 2023
*
* Author(s): Semantyk Team
* Maintainer(s): Daniel Bakas <https://id.danielbakas.com>
Expand All @@ -16,17 +16,18 @@
//* Imports
import React from "react";
//* Local Imports
import "./page.css";
import Footer from "@/frontend/ui/components/molecules/footer/component";
import "@semantyk/app/page.css";
import Header from "@semantyk/frontend/ui/components/organisms/Header";


//* Main
export default function Page({ children }) {
export default function Page(props) {
const { children, ...rest } = props;
// Return
return (
<div id="Page">
<Header {...rest}/>
{children}
<Footer/>
</div>
);
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* client | Semantyk
*
* Created: Dec 10, 2023
* Modified: Dec 10, 2023
* Modified: Dec 23, 2023
*
* Author(s): Semantyk Team
* Maintainer(s): Daniel Bakas <https://id.danielbakas.com>
Expand All @@ -14,10 +14,12 @@
*/

//* Imports
import { APP_WEBID, APP_WEBID_DOC } from "@/backend/logic/kgm/nodes";
import { getThing } from "@/backend/api/solid/getThing";
import { getProperties } from "@/backend/api/solid/getProperties";
import { appShape } from "@/backend/logic/kgm/shapes";
import { APP_WEBID, APP_WEBID_DOC } from "@semantyk/backend/logic/kgm/nodes";
import { getThing } from "@semantyk/backend/api/solid/services/getThing";
import {
getProperties
} from "@semantyk/backend/api/solid/services/getProperties";
import { appShape } from "@semantyk/backend/logic/kgm/shapes";

//* Main
export async function getAppKnowledge(fetch) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* client | Semantyk
*
* Created: Dec 05, 2023
* Modified: Dec 10, 2023
* Modified: Dec 23, 2023
*
* Author(s): Semantyk Team
* Maintainer(s): Daniel Bakas <https://id.danielbakas.com>
Expand All @@ -14,12 +14,14 @@
*/

//* Local Imports
import { getAppKnowledge } from "@/backend/api/knowledge/getAppKnowledge";
import {
getAppKnowledge
} from "@semantyk/backend/api/knowledge/services/getAppKnowledge";

//* Main
export async function getKnowledge(fetch) {
// Logic
const appData = await getAppKnowledge(fetch);
const appKnowledge = await getAppKnowledge(fetch);
// Props
const team = "Semantyk Team";
const twitter = "@semantyk";
Expand All @@ -28,6 +30,6 @@ export async function getKnowledge(fetch) {
author: team,
creator: team,
twitter,
...appData
...appKnowledge
};
}
26 changes: 26 additions & 0 deletions src/backend/api/solid/services/getDataset.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
/*
* ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“
* # `getDataset.js`
* client | Semantyk
*
* Created: Dec 23, 2023
* Modified: Dec 23, 2023
*
* Author(s): Semantyk Team
* Maintainer(s):
*
* Copyright Ā© Semantyk 2023. All rights reserved.
* ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“ā€“
*/

import { getSolidDataset } from "@inrupt/solid-client";

export const getDataset = async (fetch, uri, type = "solid") => {
switch (type) {
case "solid":
return await getSolidDataset(uri, { fetch });
default:
const document = await fetch(uri, { headers: { Accept: type } });
return await document.text();
}
};
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* client | Semantyk
*
* Created: Dec 10, 2023
* Modified: Dec 10, 2023
* Modified: Dec 22, 2023
*
* Author(s): Semantyk Team
* Maintainer(s): Daniel Bakas <https://id.danielbakas.com>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* client | Semantyk
*
* Created: Dec 10, 2023
* Modified: Dec 10, 2023
* Modified: Dec 22, 2023
*
* Author(s): Semantyk Team
* Maintainer(s): Daniel Bakas <https://id.danielbakas.com>
Expand All @@ -14,14 +14,16 @@
*/

//* Imports
import { getProperty } from "@/backend/api/solid/getProperty";
import { getProperty } from "@semantyk/backend/api/solid/services/getProperty";

//* Main
export const getProperties = (thing, shape, locale) => {
// Logic
let properties = { lang: locale };
for (const { ns, fragment, type } of shape) {
const property = ns + fragment;
properties[fragment] = getProperty(thing, type, property, locale);
}
// Return
return properties;
};
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* client | Semantyk
*
* Created: Dec 10, 2023
* Modified: Dec 10, 2023
* Modified: Dec 23, 2023
*
* Author(s): Semantyk Team
* Maintainer(s): Daniel Bakas <https://id.danielbakas.com>
Expand All @@ -14,15 +14,15 @@
*/

//* Imports
import { getNumber } from "@/backend/api/solid/getNumber";
import { getNumber } from "@semantyk/backend/api/solid/services/getNumber";
import {
getStringNoLocale,
getStringNoLocaleAll,
getStringWithLocaleAll
} from "@inrupt/solid-client";
import { getURLAll } from "@/backend/api/solid/getURLAll";
import { getString } from "@/backend/api/solid/getString";
import { getURL } from "@/backend/api/solid/getURL";
import { getURLAll } from "@semantyk/backend/api/solid/services/getURLAll";
import { getString } from "@semantyk/backend/api/solid/services/getString";
import { getURL } from "@semantyk/backend/api/solid/services/getURL";

//* Main
export const getProperty = (thing, type, property, locale) => {
Expand Down
Loading

0 comments on commit c3e0a5a

Please sign in to comment.