Skip to content

Commit

Permalink
Merge pull request #3 from wpdas/staging
Browse files Browse the repository at this point in the history
Staging -> Main
  • Loading branch information
wpdas committed Mar 22, 2024
2 parents 29b5f8c + 114f69c commit 266e89f
Show file tree
Hide file tree
Showing 25 changed files with 469 additions and 445 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,5 @@
.env

# misc
.DS_Store
.DS_Store
errors
6 changes: 1 addition & 5 deletions bos.config.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,5 @@
"near",
"bos",
"react"
],
"options": {
"showFallbackSpinner": false,
"maintainRouteWhenDeveloping": true
}
]
}
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"deploy:testnet": "npm run build; alem deploy --network testnet"
},
"dependencies": {
"alem": "0.0.1-alpha.23"
"alem": "1.0.0-alpha.0"
},
"devDependencies": {
"@types/styled-components": "^5.1.26",
Expand Down
277 changes: 109 additions & 168 deletions src/Routes.tsx
Original file line number Diff line number Diff line change
@@ -1,186 +1,127 @@
import { Routes, createRoute } from "alem/router";
import {
BOSPropsPage,
CLIPage,
ClearStorePage,
ConfigFilePage,
CreateRoutePage,
CreatingStorePage,
DeployingWithGithubActionsPage,
// RoadmapPage,
FeatureOverviewPage,
GetStorePage,
InstallationPage,
LoadExternalStylesPage,
NavigatePage,
PromisifyPage,
IsDevelopmentPage,
RouteLinkPage,
RoutesPage,
UseLocationPage,
UseParamsPage,
} from "./pages";
import { Router, createRoute, useParams } from "alem";
import { AboutPage } from "./pages/About/About";
import { RoutesPath } from "./routeProps";
import MarkdownPage from "./pages/MarkdownPage/MarkdownPage";

export const Categories = {
gettingStarted: "Getting Started",
router: "Router",
apis: "APIs",
store: "Store",
bos: "BOS",
type Props = {
libVersion: string;
};

export type RoutesPathProps = Record<string, { path: string; title: string; category: string }>;
const Routes = ({ libVersion }: Props) => {
const AboutPageRoute = createRoute(RoutesPath.about.path, AboutPage);

export const RoutesPath = {
// About
about: {
path: "about",
title: "About",
category: Categories.gettingStarted,
},
// Getting Started
featureOverview: {
path: "feature-overview",
title: "Feature Overview",
category: Categories.gettingStarted,
},
installation: {
path: "installation",
title: "Installation",
category: Categories.gettingStarted,
},
configFile: {
path: "config-file",
title: "Config File",
category: Categories.gettingStarted,
},
cli: {
path: "cli",
title: "CLI",
category: Categories.gettingStarted,
},
deployingWithGithubActions: {
path: "deploying-with-github-actions",
title: "Deploying with GitHub Actions",
category: Categories.gettingStarted,
},
// roadmap: {
// path: "roadmap",
// title: "Roadmap",
// category: Categories.gettingStarted,
// },

// Router
routes: {
path: "routes",
title: "Routes",
category: Categories.router,
},
createRoute: {
path: "create-route",
title: "Create Route",
category: Categories.router,
},
routeLink: {
path: "route-link",
title: "Route Link",
category: Categories.router,
},
navigate: {
path: "navigate",
title: "Navigate",
category: Categories.router,
},
useLocation: {
path: "use-location",
title: "Use Location",
category: Categories.router,
},
useParams: {
path: "use-params",
title: "Use Params",
category: Categories.router,
},
const routes = [
AboutPageRoute,

// APIs
loadExternalStyles: {
path: "load-external-styles",
title: "Load External Styles",
category: Categories.apis,
},
promisify: {
path: "promisify",
title: "Promisify",
category: Categories.apis,
},
isDevelopment: {
path: "is-development",
title: "Is Development",
category: Categories.apis,
},
{
path: RoutesPath.featureOverview.path,
component: () => (
<MarkdownPage
mdFileURL={`https://cdn.jsdelivr.net/gh/wpdas/alem/docs/feature-overview.md`}
/>
),
},

// Store
creatingStore: {
path: "creating-a-store",
title: "Creating Store",
category: Categories.store,
},
getStore: {
path: "get-store",
title: "Get Store",
category: Categories.store,
},
clearStore: {
path: "clear-store",
title: "Clear Store",
category: Categories.store,
},
createRoute(RoutesPath.installation.path, () => (
<MarkdownPage mdFileURL={`https://cdn.jsdelivr.net/gh/wpdas/alem/docs/installation.md`} />
)),

// BOS API
bosProps: {
path: "bos-props",
title: "APIs and Components",
category: Categories.bos,
},
};

const AppRoutes = () => {
const routes = [
// About
createRoute(RoutesPath.about.path, AboutPage),

// Getting Started
createRoute(RoutesPath.featureOverview.path, FeatureOverviewPage),
createRoute(RoutesPath.installation.path, InstallationPage),
createRoute(RoutesPath.configFile.path, ConfigFilePage),
createRoute(RoutesPath.cli.path, CLIPage),
createRoute(RoutesPath.deployingWithGithubActions.path, DeployingWithGithubActionsPage),
// createRoute(RoutesPath.roadmap.path, RoadmapPage),
createRoute(RoutesPath.configFile.path, () => (
<MarkdownPage mdFileURL={`https://cdn.jsdelivr.net/gh/wpdas/alem/docs/config-file.md`} />
)),
createRoute(RoutesPath.cli.path, () => (
<MarkdownPage mdFileURL={`https://cdn.jsdelivr.net/gh/wpdas/alem/docs/cli.md`} />
)),
createRoute(RoutesPath.deployingWithGithubActions.path, () => (
<MarkdownPage
mdFileURL={`https://cdn.jsdelivr.net/gh/wpdas/alem/docs/deploying-with-github-actions.md`}
/>
)),

// Router
createRoute(RoutesPath.routes.path, RoutesPage),
createRoute(RoutesPath.createRoute.path, CreateRoutePage),
createRoute(RoutesPath.routeLink.path, RouteLinkPage),
createRoute(RoutesPath.navigate.path, NavigatePage),
createRoute(RoutesPath.useLocation.path, UseLocationPage),
createRoute(RoutesPath.useParams.path, UseParamsPage),
createRoute(RoutesPath.routes.path, () => (
<MarkdownPage mdFileURL={`https://cdn.jsdelivr.net/gh/wpdas/alem/docs/router/routes.md`} />
)),
createRoute(RoutesPath.createRoute.path, () => (
<MarkdownPage
mdFileURL={`https://cdn.jsdelivr.net/gh/wpdas/alem/docs/router/create-route.md`}
/>
)),
createRoute(RoutesPath.routeLink.path, () => (
<MarkdownPage
mdFileURL={`https://cdn.jsdelivr.net/gh/wpdas/alem/docs/router/route-link.md`}
/>
)),
createRoute(RoutesPath.navigate.path, () => (
<MarkdownPage mdFileURL={`https://cdn.jsdelivr.net/gh/wpdas/alem/docs/router/navigate.md`} />
)),
createRoute(RoutesPath.routerProvider.path, () => (
<MarkdownPage
mdFileURL={`https://cdn.jsdelivr.net/gh/wpdas/alem/docs/router/router-provider.md`}
/>
)),
createRoute(RoutesPath.useLocation.path, () => (
<MarkdownPage
mdFileURL={`https://cdn.jsdelivr.net/gh/wpdas/alem/docs/router/use-location.md`}
/>
)),
createRoute(RoutesPath.useParams.path, () => (
<MarkdownPage
mdFileURL={`https://cdn.jsdelivr.net/gh/wpdas/alem/docs/router/use-params.md`}
/>
)),
createRoute(RoutesPath.useRoutes.path, () => (
<MarkdownPage
mdFileURL={`https://cdn.jsdelivr.net/gh/wpdas/alem/docs/router/use-routes.md`}
/>
)),

// APIs
createRoute(RoutesPath.loadExternalStyles.path, LoadExternalStylesPage),
createRoute(RoutesPath.promisify.path, PromisifyPage),
createRoute(RoutesPath.isDevelopment.path, IsDevelopmentPage),
// Context
createRoute(RoutesPath.createContext.path, () => (
<MarkdownPage
mdFileURL={`https://cdn.jsdelivr.net/gh/wpdas/alem/docs/context/create-context.md`}
/>
)),
createRoute(RoutesPath.useContext.path, () => (
<MarkdownPage
mdFileURL={`https://cdn.jsdelivr.net/gh/wpdas/alem/docs/context/use-context.md`}
/>
)),

// Store
createRoute(RoutesPath.creatingStore.path, CreatingStorePage),
createRoute(RoutesPath.getStore.path, GetStorePage),
createRoute(RoutesPath.clearStore.path, ClearStorePage),
// APIs
createRoute(RoutesPath.loadExternalStyles.path, () => (
<MarkdownPage
mdFileURL={`https://cdn.jsdelivr.net/gh/wpdas/alem/docs/api/load-external-styles.md`}
/>
)),
createRoute(RoutesPath.promisify.path, () => (
<MarkdownPage mdFileURL={`https://cdn.jsdelivr.net/gh/wpdas/alem/docs/api/promisify.md`} />
)),
createRoute(RoutesPath.isDevelopment.path, () => (
<MarkdownPage
mdFileURL={`https://cdn.jsdelivr.net/gh/wpdas/alem/docs/api/is-development.md`}
/>
)),

// BOS API
createRoute(RoutesPath.bosProps.path, BOSPropsPage),
createRoute(RoutesPath.bosProps.path, () => (
<MarkdownPage mdFileURL={`https://cdn.jsdelivr.net/gh/wpdas/alem/docs/bos-overview.md`} />
)),
];

return <Routes routes={routes} type="ContentBased" />;
const urlParams = useParams();

return (
<>
{/* <Router routes={routes} parameterName="tab" /> */}
<Router
routes={routes}
type="ContentBased"
parameterName="tab"
initialRoute={urlParams.section}
/>
</>
);
};

export default AppRoutes;
export default Routes;
File renamed without changes.
File renamed without changes.
50 changes: 6 additions & 44 deletions src/components/ContentView/index.tsx
Original file line number Diff line number Diff line change
@@ -1,52 +1,14 @@
import AppRoutes from "../../Routes";
import Routes from "../../Routes";
import { Container } from "./styles";
import { navigate, useEffect, useLocation, useParams, useState } from "alem";

const ContentView = () => {
// BOS -- ALEM: Usado para testar useState / useEffect
// BOS
// const foooBarrr = useState(1);
// const [valor, setValor] = foooBarrr;
// console.log("BOS useState:", foooBarrr);

// ALEM
// const foo = useStore("teste");
// const { count } = foo;
// console.log("FOO-> Count", foo.count, count, valor);

// let sectionUsed = false;
const [sectionUsed, setSectionUsed] = useState(false);

// Watch the section parameter.
const urlParams = useParams();
const { isRoutesReady } = useLocation();

useEffect(() => {
if (urlParams.section && !sectionUsed && isRoutesReady) {
navigate(urlParams.section);
setSectionUsed(true);
}
}, [urlParams, sectionUsed, isRoutesReady]);
type Props = {
libVersion: string;
};

const ContentView = ({ libVersion }: Props) => {
return (
<Container>
{/* <button
onClick={() => {
// setValor(valor + 1);
foo.update({ count: count + 1 });
setValor(count + 1);
}}
>
ALEM {count}
</button>
<button
onClick={() => {
setValor(valor + 1);
}}
>
BOS {valor}
</button> */}
<AppRoutes />
<Routes libVersion={libVersion} />
</Container>
);
};
Expand Down
4 changes: 2 additions & 2 deletions src/components/Footer/Footer.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import TelegramIcon from "../../assets/svgs/telegram-icon";
import { GithubIcon } from "../../assets/svgs/github-icon";
import TelegramIcon from "../../assets/svgs/telegram-icon.module";
import { GithubIcon } from "../../assets/svgs/github-icon.module";
import { Container, Description, Item, Logo, Socials } from "./styles";
import { Row } from "../UI";

Expand Down
Loading

0 comments on commit 266e89f

Please sign in to comment.