Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

basic routes and nav redesign #7

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2,685 changes: 743 additions & 1,942 deletions package-lock.json

Large diffs are not rendered by default.

22 changes: 11 additions & 11 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,25 +28,25 @@
"clean": "rm -rf dist node_modules server tmp"
},
"devDependencies": {
"@builder.io/qwik": "^1.2.13",
"@builder.io/qwik-city": "^1.2.13",
"@builder.io/qwik": "^1.2.14",
"@builder.io/qwik-city": "^1.2.14",
"@dnlup/fastify-traps": "^3.0.0",
"@fastify/compress": "^6.4.0",
"@fastify/static": "^6.11.2",
"@types/eslint": "8.44.4",
"@types/node": "^20.8.6",
"@typescript-eslint/eslint-plugin": "6.7.5",
"@typescript-eslint/parser": "6.7.5",
"@types/eslint": "8.44.6",
"@types/node": "^20.8.7",
"@typescript-eslint/eslint-plugin": "6.8.0",
"@typescript-eslint/parser": "6.8.0",
"@vanilla-extract/css": "^1.13.0",
"eslint": "8.51.0",
"eslint-plugin-qwik": "^1.2.13",
"fastify": "^4.24.1",
"eslint": "8.52.0",
"eslint-plugin-qwik": "^1.2.14",
"fastify": "^4.24.3",
"fastify-plugin": "^4.5.1",
"prettier": "3.0.3",
"styled-vanilla-extract": "^0.5.7",
"typescript": "5.2.2",
"undici": "5.26.3",
"vite": "4.4.11",
"undici": "5.26.4",
"vite": "4.5.0",
"vite-tsconfig-paths": "4.2.1"
},
"dependencies": {
Expand Down
8 changes: 3 additions & 5 deletions src/components/sidenav/sidenav.css.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,17 @@ import { type ComplexStyleRule, style } from "@vanilla-extract/css";
import { mediaQuery } from "~/breakpoint.css";

const mobile: ComplexStyleRule = {
gridTemplateColumns: "repeat( auto-fit, minmax(60px, 1fr) )",
gridTemplateRows: "none",
flexFlow: "row wrap",
};

const desktop: ComplexStyleRule = {
gridTemplateColumns: "none",
gridTemplateRows: "repeat(6, 1fr)",
flexFlow: "column",
};

export const sidenav = style([
mobile,
{
display: "grid",
display: "flex",
gap: "2px",
justifyItems: "center",
justifyContent: "center",
Expand Down
67 changes: 43 additions & 24 deletions src/components/sidenav/sidenav.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,34 +8,53 @@ import ChartSvg from "~/media/icons/dark_theme/chart.svg?jsx";
import WalletSvg from "~/media/icons/dark_theme/wallet.svg?jsx";
import PeopleSvg from "~/media/icons/dark_theme/people.svg?jsx";
import SettingsSvg from "~/media/icons/dark_theme/settings.svg?jsx";
import BusinessSvg from "~/media/icons/dark_theme/business.svg?jsx";

export const SideNav = component$(() => {
return (
<div class={sidenav}>
<IconButton>
<HomeSvg style={{ height: "24px" }} q:slot="icon"></HomeSvg>
{/* <div q:slot="text">Home</div> */}
</IconButton>
<IconButton>
<TransferSvg q:slot="icon"></TransferSvg>
{/* <div q:slot="text">Home</div> */}
</IconButton>
<IconButton>
<ChartSvg q:slot="icon"></ChartSvg>
{/* <div q:slot="text">Home</div> */}
</IconButton>
<IconButton>
<WalletSvg q:slot="icon"></WalletSvg>
{/* <div q:slot="text">Home</div> */}
</IconButton>
<IconButton>
<PeopleSvg q:slot="icon"></PeopleSvg>
{/* <div q:slot="text">Home</div> */}
</IconButton>
<IconButton>
<SettingsSvg q:slot="icon"></SettingsSvg>
{/* <div q:slot="text">Home</div> */}
</IconButton>
<a href="/">
<IconButton>
<HomeSvg style={{ height: "24px" }} q:slot="icon"></HomeSvg>
{/* <div q:slot="text">Home</div> */}
</IconButton>
</a>
<a href="/transfer">
<IconButton>
<TransferSvg q:slot="icon"></TransferSvg>
{/* <div q:slot="text">Home</div> */}
</IconButton>
</a>
<a href="/exchange">
<IconButton>
<ChartSvg q:slot="icon"></ChartSvg>
{/* <div q:slot="text">Home</div> */}
</IconButton>
</a>
<a href="/wallet">
<IconButton>
<WalletSvg q:slot="icon"></WalletSvg>
{/* <div q:slot="text">Home</div> */}
</IconButton>
</a>
<a href="/business">
<IconButton>
<BusinessSvg q:slot="icon"></BusinessSvg>
{/* <div q:slot="text">Home</div> */}
</IconButton>
</a>
<a href="/people">
<IconButton>
<PeopleSvg q:slot="icon"></PeopleSvg>
{/* <div q:slot="text">Home</div> */}
</IconButton>
</a>
<a href="/account">
<IconButton>
<SettingsSvg q:slot="icon"></SettingsSvg>
{/* <div q:slot="text">Home</div> */}
</IconButton>
</a>
</div>
);
});
5 changes: 5 additions & 0 deletions src/media/icons/dark_theme/account.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
8 changes: 8 additions & 0 deletions src/media/icons/dark_theme/orderbook.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 5 additions & 0 deletions src/media/icons/dark_theme/positions.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 5 additions & 0 deletions src/media/icons/dark_theme/search.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 5 additions & 0 deletions src/media/icons/dark_theme/send.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 6 additions & 0 deletions src/media/icons/dark_theme/trades.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
16 changes: 16 additions & 0 deletions src/routes/account/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import { component$ } from "@builder.io/qwik";
import type { DocumentHead } from "@builder.io/qwik-city";

export default component$(() => {
return <></>;
});

export const head: DocumentHead = {
title: "KSOX-account",
meta: [
{
name: "description",
content: "Account control panel",
},
],
};
16 changes: 16 additions & 0 deletions src/routes/business/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import { component$ } from "@builder.io/qwik";
import type { DocumentHead } from "@builder.io/qwik-city";

export default component$(() => {
return <></>;
});

export const head: DocumentHead = {
title: "KSOX-business",
meta: [
{
name: "description",
content: "Crypto business platform",
},
],
};
33 changes: 33 additions & 0 deletions src/routes/exchange/[market]/index.css.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
import { style } from "@vanilla-extract/css";
import { vars } from "~/theme.css";

const background = style({
backgroundColor: vars.color.background,
});

export const mainBuySell = style({
height: "100%",
display: "grid",
gridTemplateColumns: "1fr 300px",
gap: "1px",
});

export const buySell = style([background, {}]);

export const mainPosition = style({
display: "grid",
gridTemplateRows: "1fr 350px",
gap: "1px",
});

export const position = style([background, {}]);

export const chartOrderbook = style({
display: "grid",
gridTemplateColumns: "1fr 350px",
gap: "1px",
});

export const chart = style([background, {}]);

export const orderbook = style([background, {}]);
48 changes: 48 additions & 0 deletions src/routes/exchange/[market]/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
import { component$ } from "@builder.io/qwik";
import { type RequestHandler, routeLoader$ } from "@builder.io/qwik-city";
import { parseMarket } from "./parseMarket";
import {
buySell,
chart,
chartOrderbook,
mainBuySell,
mainPosition,
orderbook,
position,
} from "./index.css";

export const onRequest: RequestHandler = ({ params, redirect, sharedMap }) => {
try {
const market = parseMarket(params.market);
sharedMap.set("quoteAsset", market.quoteAsset);
sharedMap.set("baseAsset", market.baseAsset);
} catch (error) {
redirect(300, "/");
}
};

export const useMarket = routeLoader$(({ sharedMap }) => {
return {
quoteAsset: sharedMap.get("quoteAsset") as string,
baseAsset: sharedMap.get("baseAsset") as string,
};
});

export default component$(() => {
const { quoteAsset, baseAsset } = useMarket().value;
console.log(quoteAsset);
console.log(baseAsset);

return (
<div class={mainBuySell}>
<div class={mainPosition}>
<div class={chartOrderbook}>
<div class={chart}></div>
<div class={orderbook}></div>
</div>
<div class={position}></div>
</div>
<div class={buySell}></div>
</div>
);
});
12 changes: 12 additions & 0 deletions src/routes/exchange/[market]/parseMarket.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
export const parseMarket = (market: string) => {
const regex = /^(\w+)-(\w+)$/;
const match = market.match(regex);
if (match) {
return {
quoteAsset: match[1].toUpperCase(),
baseAsset: match[2].toUpperCase(),
};
} else {
throw new Error("Cound not parse market");
}
};
13 changes: 13 additions & 0 deletions src/routes/exchange/index.css.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import { style } from "@vanilla-extract/css";
import { vars } from "~/theme.css";

const background = style({
backgroundColor: vars.color.background,
});

export const index = style([
background,
{
height: "100%",
},
]);
17 changes: 17 additions & 0 deletions src/routes/exchange/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import { component$ } from "@builder.io/qwik";
import type { DocumentHead } from "@builder.io/qwik-city";
import { index } from "./index.css";

export default component$(() => {
return <div class={index}></div>;
});

export const head: DocumentHead = {
title: "KSOX-exchange",
meta: [
{
name: "description",
content: "Exchange crypto",
},
],
};
Empty file.
9 changes: 9 additions & 0 deletions src/routes/exchange/layout.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import { component$, Slot } from "@builder.io/qwik";

export default component$(() => {
return (
<>
<Slot />
</>
);
});
2 changes: 1 addition & 1 deletion src/routes/main.css.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ const desktop: ComplexStyleRule = {
export const main = style([
mobile,
{
backgroundColor: vars.color.background,
backgroundColor: vars.color.backgroundHighlight,
"@media": {
[mediaQuery.desktop]: desktop,
},
Expand Down
16 changes: 16 additions & 0 deletions src/routes/people/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import { component$ } from "@builder.io/qwik";
import type { DocumentHead } from "@builder.io/qwik-city";

export default component$(() => {
return <></>;
});

export const head: DocumentHead = {
title: "KSOX-people",
meta: [
{
name: "description",
content: "Find people manage friends",
},
],
};
12 changes: 12 additions & 0 deletions src/routes/transfer/[id]/index.css.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import { style } from "@vanilla-extract/css";
import { background } from "../layout.css";

export const conversation = style({
display: "grid",
gridTemplateRows: "1fr 100px",
gap: "1px",
});

export const chat = style([background, {}]);

export const message = style([background, {}]);
Loading