Skip to content

Commit

Permalink
fix: router issues
Browse files Browse the repository at this point in the history
  • Loading branch information
TechInnovatorAI committed Sep 5, 2024
1 parent bd7ab07 commit 4c299af
Show file tree
Hide file tree
Showing 4 changed files with 52 additions and 48 deletions.
Empty file.
11 changes: 0 additions & 11 deletions netlify.toml

This file was deleted.

59 changes: 46 additions & 13 deletions packages/guider/src/client/partials/header/header.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,8 @@ import classNames from 'classnames';
import { Sun, Moon } from 'lucide-react';
import { GuiderLayoutContext } from '../../page/context';
import { useGuider } from '../../hooks/use-guider';
import { GithubDisplay } from '../../components/github';
import { GuiderLogo } from '../logo';
import { HeaderTabs } from './tabs';
import { HeaderNav } from './nav';
import { HeaderDropdown } from './dropdown';
import { SidebarMobileNav } from './sidebar-mobile-nav';
import { TopMobileNav } from './top-mobile-nav';
import { HeaderSearch } from './search';
Expand All @@ -19,7 +16,10 @@ export function HeaderInternal() {

useEffect(() => {
// Apply theme based on state
document.documentElement.setAttribute('data-theme', isDark ? 'dark' : 'light');
document.documentElement.setAttribute(
'data-theme',
isDark ? 'dark' : 'light',
);
}, [isDark]);

const [isScrolledFromTop, setIsScrolledFromTop] = useState(false);
Expand All @@ -40,14 +40,14 @@ export function HeaderInternal() {
className={classNames(
'gd-sticky gd-z-50 gd-top-0 gd-transition-colors gd-duration-300 gd-mb-8',
isScrolledFromTop ? 'gd-bg-opacity-100' : 'gd-bg-opacity-0',
{ 'gd-dark': isDark, 'gd-light': !isDark }
{ 'gd-dark': isDark, 'gd-light': !isDark },
)}
>
<header
className={classNames(
'gd-max-w-[1480px] gd-mx-auto',
'gd-py-3 gd-px-8 gd-border-b gd-border-line',
isScrolledFromTop ? 'gd-bg-opacity-100' : 'gd-bg-opacity-0'
isScrolledFromTop ? 'gd-bg-opacity-100' : 'gd-bg-opacity-0',
)}
>
<div className="gd-fixed neato-guider-overlay gd-transition-opacity gd-duration-150 gd-opacity-0 gd-inset-0 gd-bg-gradient-to-b gd-from-black/80 gd-to-transparent gd-z-[60] gd-pointer-events-none" />
Expand All @@ -56,13 +56,46 @@ export function HeaderInternal() {
<GuiderLogo />
</div>
<HeaderSearch />
<div className='gd-flex gd-items-center gd-space-x-6'>
<h4 className='gd-text-sm gd-text-gray-600 gd-font-normal hover:gd-text-gray-900 gd-cursor-pointer'>Email Support</h4>
<a href="https://polymarket.com" target={'_blank'} className='hover:gd-bg-[#426CFF] gd-flex gd-gap-2 gd-items-center gd-text-sm dark:gd-bg-transparent dark:gd-border dark:gd-border-[#2E5CFF] dark:gd-bg-[#0E1226] dark:gd-text-[#2E5CFF] gd-bg-[#2E5CFF] gd-text-white gd-py-1 gd-px-4 gd-rounded-full'>Polymarket <svg width="3" height="24" viewBox="0 -9 3 24" class="h-5 rotate-0 overflow-visible text-white/90 dark:text-primary-light"><path d="M0 0L3 3L0 6" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round"></path></svg></a>
{isDark ?
<Moon onClick={() => setIsDark(false)} className='gd-cursor-pointer gd-w-5 gd-opacity-50 hover:gd-opacity-100'/> :
<Sun onClick={() => setIsDark(true)} className='gd-cursor-pointer gd-w-5 gd-opacity-50 hover:gd-opacity-100'/>
}
<div className="gd-flex gd-items-center gd-space-x-6">
<h4 className="gd-text-sm gd-text-gray-600 gd-font-normal hover:gd-text-gray-900 gd-cursor-pointer">
Email Support
</h4>
<a
href="https://polymarket.com"
target={'_blank'}
className="hover:gd-bg-[#426CFF] gd-flex gd-gap-2 gd-items-center gd-text-sm dark:gd-bg-transparent dark:gd-border dark:gd-border-[#2E5CFF] dark:gd-bg-[#0E1226] dark:gd-text-[#2E5CFF] gd-bg-[#2E5CFF] gd-text-white gd-py-1 gd-px-4 gd-rounded-full"
>
Polymarket{' '}
<svg
width="3"
height="24"
viewBox="0 -9 3 24"
className="h-5 rotate-0 overflow-visible text-white/90 dark:text-primary-light"
>
<path
d="M0 0L3 3L0 6"
fill="none"
stroke="currentColor"
stroke-width="1.5"
stroke-linecap="round"
></path>
</svg>
</a>
{isDark ? (
<Moon
onClick={() => {
setIsDark(false);
}}
className="gd-cursor-pointer gd-w-5 gd-opacity-50 hover:gd-opacity-100"
/>
) : (
<Sun
onClick={() => {
setIsDark(true);
}}
className="gd-cursor-pointer gd-w-5 gd-opacity-50 hover:gd-opacity-100"
/>
)}
</div>
<div className="gd-flex md:gd-hidden gd-items-center">
{site.navigation.length > 0 || site.github ? (
Expand Down
30 changes: 6 additions & 24 deletions packages/router/src/router/create.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import type {
RawRequestDefaultExpression,
RawServerBase,
RouteGenericInterface,
RouteHandlerMethod,
// RouteHandlerMethod,
} from 'fastify';
import type { ZodTypeProvider } from 'fastify-type-provider-zod';
import type { NeatHandler } from './handler';
Expand Down Expand Up @@ -80,7 +80,7 @@ export interface Router<
function makeHandler<
RawServer extends RawServerBase,
RawRequest extends RawRequestDefaultExpression<RawServer>,
RawReply extends RawReplyDefaultExpression<RawServer>,
// RawReply extends RawReplyDefaultExpression<RawServer>,
RouteGeneric extends RouteGenericInterface,
ContextConfig,
SchemaCompiler extends FastifySchema,
Expand All @@ -96,17 +96,8 @@ function makeHandler<
Logger,
TypeProvider
>,
): RouteHandlerMethod<
RawServer,
RawRequest,
RawReply,
RouteGeneric,
ContextConfig,
SchemaCompiler,
TypeProvider,
Logger
> {
return async (req, reply) => {
): any {
return async (req: any, reply: any) => {
const res = await handler({
body: req.body,
params: req.params,
Expand Down Expand Up @@ -151,16 +142,7 @@ export function makeRouter<
Logger,
TypeProvider
>,
): Router<
RawServer,
RawRequest,
RawReply,
RouteGeneric,
ContextConfig,
SchemaCompiler,
Logger,
TypeProvider
> {
): any {
const app = inputRouter.withTypeProvider<ZodTypeProvider>();

function registerEndpoint(endpoint: EndpointType): void {
Expand All @@ -173,7 +155,7 @@ export function makeRouter<

return {
app,
endpoint(ops) {
endpoint(ops: any) {
registerEndpoint(ops);
},
delete: () => null,
Expand Down

0 comments on commit 4c299af

Please sign in to comment.