Skip to content

Commit

Permalink
Merge pull request #30 from Monobladegg/main
Browse files Browse the repository at this point in the history
Fix search account and bug white theme
  • Loading branch information
grandmotivator authored Aug 3, 2024
2 parents a62757a + 59e75b8 commit df3bacb
Show file tree
Hide file tree
Showing 17 changed files with 466 additions and 1,289 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/nextjs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -93,4 +93,4 @@ jobs:
- name: Deploy to GitHub Pages
if: github.ref == 'refs/heads/main'
id: deployment
uses: actions/deploy-pages@v4
uses: actions/deploy-pages@v4
44 changes: 25 additions & 19 deletions app/globals.css
Original file line number Diff line number Diff line change
@@ -1,18 +1,27 @@
.blue-ribbon {
border-top: 3px solid #08b5e5;
border-top: 3px solid #08B5E5;
}

.search {
width: 100%;
border: 1px solid #08b5e5 !important;
padding: 10px;
outline: 1px solid #08b5e5; padding: 10px;
border-radius: 20px;
background: transparent;
text-align: center;
color: white;
box-shadow: 1px 1px #08b5e5 !important;
}

/* .search-light {
width: 100%;
border: 1px solid #66666681 !important;
padding: 10px;
border-radius: 20px;
background: transparent;
text-align: center;
color: white;
box-shadow: 1px 4px #66666681 !important;
} */

.search:focus-visible {
outline: none;
}
Expand Down Expand Up @@ -80,7 +89,6 @@ html {
height: 100%;
}


body {
font-smoothing: antialiased;
-webkit-font-smoothing: antialiased;
Expand All @@ -89,7 +97,7 @@ body {
font-family: ClearSans, sans-serif;
font-size: 1.6rem;
font-weight: 300;
letter-spacing: .01em;
letter-spacing: 0.01em;
line-height: 1.4285;
margin: 0;
min-width: 320px;
Expand Down Expand Up @@ -133,13 +141,11 @@ h5,
h6 {
font-family: Roboto Condensed, Arial, Helvetica, sans-serif;
font-weight: 300;
letter-spacing: -.02em;
margin-bottom: .5em;
margin-top: .5em;
letter-spacing: -0.02em;
margin-bottom: 0.5em;
margin-top: 0.5em;
}



/*
Reset links to optimize for opt-in styling instead of opt-out.
*/
Expand Down Expand Up @@ -187,6 +193,10 @@ small {
Prevent `sub` and `sup` elements from affecting the line height in all browsers.
*/

.text-color {
color: #999;
}

sub,
sup {
font-size: 75%;
Expand Down Expand Up @@ -483,7 +493,7 @@ video {
--color-modal-bg: #0003;
}

:root[data-theme=night] {
:root[data-theme="night"] {
--color-bg: #1b414a;
--color-dashboard-bg: #272c2e;
--color-alt-bg: #12363f;
Expand Down Expand Up @@ -1516,8 +1526,6 @@ html {
scroll-behavior: smooth;
}



::-webkit-scrollbar {
height: 6px;
width: 6px;
Expand Down Expand Up @@ -2081,7 +2089,6 @@ html {
content: "\2191"; /* Unicode for upward arrow */
}


.icon-arrow-down:before {
content: "\2193"; /* Unicode for downward arrow */
}
Expand Down Expand Up @@ -2909,8 +2916,6 @@ p {
text-align: justify;
}



h1 {
font-size: 3rem;
line-height: 1.2;
Expand Down Expand Up @@ -3001,7 +3006,8 @@ code {
color: #0691b7;
}

.dimmed, .label {
.dimmed,
.label {
color: var(--color-dimmed);
}

Expand Down Expand Up @@ -3275,7 +3281,7 @@ ol > li > * {

dl {
display: block;
letter-spacing: -.03em;
letter-spacing: -0.03em;
line-height: 1.59992;
margin: 0;
}
Expand Down
45 changes: 5 additions & 40 deletions app/layout.js
Original file line number Diff line number Diff line change
@@ -1,46 +1,12 @@
"use client";
import { Inter } from "next/font/google";
import "./globals.css";
import useTheme from "@/hook/theme";
import React, { useEffect, useState } from "react";
import Header from "@/components/layouts/header";
import Footer from "@/components/layouts/footer";
import PublicProvider, { usePublic } from "@/context/net";
import { useRouter } from "next/router";

const inter = Inter({ subsets: ["latin"] });

// const NetUpdater = () => {
// const [net, setNet] = usePublic();

// useEffect(() => {
// const handleRouteChange = () => {
// const segments = window.location.pathname.split('/');
// if (segments.includes('public')) {
// setNet('public');
// } else if (segments.includes('testnet')) {
// setNet('testnet');
// }
// };

// // Listen for route changes using popstate event
// window.addEventListener('popstate', handleRouteChange);

// // Check initial URL on mount
// handleRouteChange();

// // Clean up the event listener on unmount
// return () => {
// window.removeEventListener('popstate', handleRouteChange);
// };
// }, [setNet]);

// return null;
// };
import PublicProvider from "@/context/net";

export default function RootLayout({ children }) {
const { theme, setTheme } = useTheme();

return (
<html lang="en" data-theme={theme}>
<head>
Expand All @@ -59,14 +25,13 @@ export default function RootLayout({ children }) {
}}
/>
</head>
<body /* className={inter.className} */>
<body>
<PublicProvider>
{/* <NetUpdater /> */} {/* Component to update net based on URL */}
<main className="flex min-h-screen flex-col">
<div className="blue-ribbon"></div>
<Header />
<hr className="blue-ribbon" />
<Header theme={theme} setTheme={setTheme} />
{children}
<Footer setTheme={setTheme} />
<Footer theme={theme} setTheme={setTheme} />
</main>
</PublicProvider>
</body>
Expand Down
21 changes: 11 additions & 10 deletions app/page.js
Original file line number Diff line number Diff line change
@@ -1,27 +1,28 @@
"use client";
import React, { useState, useEffect } from "react";
import React, { useEffect } from "react";
import SearchBar from "@/components/Search";
import MainLayout from "@/components/layouts";
import { usePublic } from "@/context/net";
import { useRouter } from "next/navigation";
import useTheme from "@/hook/theme";
export default function Home() {
const { theme, setTheme } = useTheme();
const [net, setNet] = usePublic();
const route = useRouter();
useEffect(() => {
const currentPath = window.location.pathname;
if(currentPath.includes('/public/')) {
setNet('public')
} else if (currentPath.includes('/testnet/')) {
setNet('testnet')
if (currentPath.includes("/public/")) {
setNet("public");
} else if (currentPath.includes("/testnet/")) {
setNet("testnet");
} else {
setNet('public')
route.replace('/public')
setNet("public");
route.replace("/public");
}
})
});
return (
<MainLayout>
<SearchBar setParNet={setNet} />
<SearchBar />
</MainLayout>
);
}

52 changes: 0 additions & 52 deletions app/public/[id]/page.js

This file was deleted.

32 changes: 32 additions & 0 deletions app/public/account/page.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
"use client";
import PublicNet from "./publicnet"; // Adjust the import path as needed
import StellarSdk from "stellar-sdk";
import MainLayout from "@/components/layouts";
import { useEffect, useState } from "react";

export default function Page() {
const [href, setHref] = useState("");
useEffect(() => setHref(window.location.href), []);
const id = href.split("id=").pop();

if (!StellarSdk.StrKey.isValidEd25519PublicKey(id)) {
return (
<>
<MainLayout>
<div className="cotainer">
<div
className={`search error container narrow`}
style={{ padding: "20px" }}
>
<h2 className="text-overflow">
Search results for {id}
</h2>
<div>User ID not found or invalid.</div>
</div>
</div>
</MainLayout>
</>
);
}
return <PublicNet id={id} />;
}
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,7 @@ import { usePublic } from "@/context/net";
import processKeys from "@/lib/processKeys";


const PublicNet = ({ params }) => {
const { id } = params;
const PublicNet = ({ id }) => {
const [account, setAccount] = useState(id || "");
const [net, setNet] = usePublic();
const [information, setInformation] = useState({});
Expand Down Expand Up @@ -155,7 +154,7 @@ const PublicNet = ({ params }) => {
title="View on Stellar.Expert"
>
<Image
src="/stellar-expert-logo.png"
src="../stellar-expert-logo.png"
alt="Stellar Expert Logo"
className="dark:invert"
width={30}
Expand Down
16 changes: 4 additions & 12 deletions app/public/page.js
Original file line number Diff line number Diff line change
@@ -1,17 +1,9 @@
"use client";
import React, { useState, useEffect } from "react";
import SearchBar from "@/components/Search";
import MainLayout from "@/components/layouts";
import { usePublic } from "@/context/net";
import { useRouter } from "next/navigation";
export default function Home() {
const [net, setNet] = usePublic();
const route = useRouter();

export default function Home() {
return (
<MainLayout>
<SearchBar setParNet={setNet} />
</MainLayout>
<div className="page-container">
<SearchBar />
</div>
);
}

3 changes: 1 addition & 2 deletions app/testnet/page.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
"use client";
import React, { useState, useEffect } from "react";
import React from "react";
import SearchBar from "@/components/Search";
import MainLayout from "@/components/layouts";
import { usePublic } from "@/context/net";
import { useRouter } from "next/navigation";
export default function Home() {
const [net, setNet] = usePublic();
return (
Expand Down
Loading

0 comments on commit df3bacb

Please sign in to comment.