Skip to content

Commit

Permalink
fix: build error and nav link to not existing badges page
Browse files Browse the repository at this point in the history
  • Loading branch information
JannikWempe committed Apr 3, 2024
1 parent 85d9eea commit b1b7490
Show file tree
Hide file tree
Showing 19 changed files with 281 additions and 253 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@ import { getDefaultPostCoverImageUrl } from '../utils/commonUtils';
import { DEFAULT_AVATAR, blurImageDimensions } from '../utils/const/images';
import { getBlurHash, kFormatter, resizeImage } from '../utils/image';

import { Post, PostThumbnailFragment, RequiredPublicationFieldsFragment } from '../generated/graphql';
import { Post, PostThumbnailFragment, PublicationFragment } from '../generated/graphql';

const FeaturedPosts = (props: {
posts: Array<PostThumbnailFragment>;
publication: Pick<RequiredPublicationFieldsFragment, 'id' | 'features'> & {
publication: Pick<PublicationFragment, 'id' | 'features'> & {
pinnedPost?: Pick<Post, 'id'> | null;
};
}) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,13 @@ import { useState, useRef } from 'react';
import dynamic from 'next/dynamic';

import CommonHeaderIconBtn from './common-header-icon-btn';
import { Preferences, Publication, PublicationNavbarItem, User } from '../generated/graphql';
import { PublicationFragment } from '../generated/graphql';
import SearchSVG from './icons/svgs/SearchSvg';

const PublicationSearch = dynamic(() => import('./publication-search'), { ssr: false });

interface Props {
publication: Pick<Publication, 'id' | 'title' | 'url' | 'isTeam' | 'favicon' | 'links'> & {
author: Pick<User, 'id' | 'username' | 'name' | 'profilePicture'>;
} & {
preferences: Omit<Preferences, 'navbarItems'> & {
navbarItems: Array<Omit<PublicationNavbarItem, 'series'>>;
};
};
publication: Pick<PublicationFragment, 'id' | 'title' | 'url' | 'isTeam' | 'favicon' | 'links' | 'author' | 'preferences'>
}

const HeaderBlogSearch = (props: Props) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import dynamic from 'next/dynamic';
import { useState, useRef } from 'react';

import { Preferences, Publication, PublicationNavbarItem, User } from '../generated/graphql';
import { PublicationFragment } from '../generated/graphql';
import { BarsSVG } from './icons/svgs';
import CommonHeaderIconBtn from './common-header-icon-btn';

Expand All @@ -11,13 +11,7 @@ const PublicationSidebar = dynamic(() => import('./publication-sidebar'), {
});

interface Props {
publication: Pick<Publication, 'id' | 'title' | 'url' | 'isTeam' | 'favicon' | 'links'> & {
author: Pick<User, 'id' | 'username' | 'name' | 'profilePicture'>;
} & {
preferences: Omit<Preferences, 'navbarItems'> & {
navbarItems: Array<Omit<PublicationNavbarItem, 'series'>>;
};
};
publication: Pick<PublicationFragment, 'id' | 'title' | 'url' | 'isTeam' | 'favicon' | 'links' | 'about' | 'author' | 'preferences'>;
}

const LeftSidebarButton = (props: Props) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@ import { getDefaultPostCoverImageUrl } from '../utils/commonUtils';
import { blurImageDimensions } from '../utils/const/images';
import { getBlurHash, resizeImage } from '../utils/image';
import { kFormatter } from '../utils/image';
import { PostThumbnailFragment, RequiredPublicationFieldsFragment } from '../generated/graphql';
import { PostThumbnailFragment, PublicationFragment } from '../generated/graphql';

function BlogPostPreview(props: {
post: PostThumbnailFragment;
publication: Pick<RequiredPublicationFieldsFragment, 'features'>;
publication: Pick<PublicationFragment, 'features'>;
}) {
const { post, publication } = props;
const postURL = `/${post.slug}`;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { Waypoint } from 'react-waypoint';

import Button from './hn-button';
import { ChevronDownSVG } from './icons/svgs';
import { PageInfo, RequiredPublicationFieldsFragment, PostThumbnailFragment } from '../generated/graphql';
import { PageInfo, PublicationFragment, PostThumbnailFragment } from '../generated/graphql';
import BlogPostPreview from './magazine-blog-post-preview';

const PublicationPosts = (props: {
Expand All @@ -13,7 +13,7 @@ const PublicationPosts = (props: {
}>;
pageInfo: Pick<PageInfo, 'hasNextPage' | 'endCursor'>;
};
publication: Pick<RequiredPublicationFieldsFragment, 'features'>;
publication: Pick<PublicationFragment, 'features'>;
fetchMore: () => void;
fetching: boolean;
fetchedOnce: boolean;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,26 +11,12 @@ import { ChevronLeftSVG } from './icons/svgs/';
import PublicationSocialLinks from './publication-social-links';
import useStickyNavScroll from './use-sticky-nav-scroll';

import {
Preferences,
PublicationNavbarItem,
RequiredPublicationFieldsFragment,
User,
} from '../generated/graphql';
import { PublicationFragment } from '../generated/graphql';
import { Button } from './custom-button';
import PublicationLogo from './publication-logo';

type Props = {
publication: Pick<
RequiredPublicationFieldsFragment,
'id' | 'title' | 'url' | 'links' | 'features' | 'isTeam'
> & {
author: Pick<User, 'id' | 'username' | 'name' | 'profilePicture'>;
} & {
preferences: Omit<Preferences, 'navbarItems'> & {
navbarItems: Array<Omit<PublicationNavbarItem, 'series' | 'page'>>;
};
};
publication: Pick<PublicationFragment, 'id' | 'title' | 'links' | 'url' | 'features' | 'isTeam' | 'author' | 'preferences'>;
};

const PostPageNavbar = forwardRef<HTMLElement, Props>((props, ref) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,9 @@ import Link from 'next/link';
import PerfectScrollbar from 'react-perfect-scrollbar';
import * as DropdownPrimitive from '@radix-ui/react-dropdown-menu';
import { twJoin } from 'tailwind-merge';
import { useAppContext } from './contexts/appContext';
import { ChevronDownV2SVG } from './icons/svgs';
import { PublicationFragment } from '../generated/graphql';
import { MAX_MAIN_NAV_LINKS } from '../utils/const';

const PublicationNavLinksDropdown = dynamic(
() => import('./publication-nav-links-dropdown'),
Expand All @@ -15,15 +16,10 @@ const PublicationNavLinksDropdown = dynamic(
},
);

import { Publication } from '../generated/graphql';
import { MAX_MAIN_NAV_LINKS } from '../utils/const';

type Props = {
currentActiveMenuItemId?: string | null;
isHome?: boolean | null;
} & Pick<NonNullable<Publication['preferences']>, 'enabledPages' | 'navbarItems'> & {
navbarItems: Omit<Publication['preferences']['navbarItems'], 'series' | 'page'>;
};
} & Pick<NonNullable<PublicationFragment['preferences']>, 'enabledPages' | 'navbarItems'>;

function PublicationNavLinks(props: Props) {
const { currentActiveMenuItemId, isHome, enabledPages, navbarItems } = props;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@ import { ChevronDownSVG } from './icons/svgs';
import Button from './hn-button';
import PubLoaderComponent from './pub-loader-component';

import { PageInfo, Preferences, RequiredPublicationFieldsFragment, PostThumbnailFragment } from '../generated/graphql';
import { PageInfo, Preferences, PublicationFragment, PostThumbnailFragment } from '../generated/graphql';


import BlogPostPreview from './blog-post-preview';

export type RequiredPublicationProps = Pick<RequiredPublicationFieldsFragment, 'features' | 'isTeam'> & {
export type RequiredPublicationProps = Pick<PublicationFragment, 'features' | 'isTeam'> & {
preferences: Pick<Preferences, 'layout'>;
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@ import Link from 'next/link';
import { twJoin } from 'tailwind-merge';

import { CheckSVG } from './icons/svgs';
import { Publication } from '../generated/graphql';
import { PublicationFragment } from '../generated/graphql';


type IPublicationSidebarNavLinks = {
currentActiveMenuItemId?: string | null;
isHome?: boolean | null;
isBadge?: boolean | null;
} & Pick<NonNullable<Publication['preferences']>, 'enabledPages' | 'navbarItems'>;
} & Pick<NonNullable<PublicationFragment['preferences']>, 'enabledPages' | 'navbarItems'>;

type IPublicationSidebarNavLinkItem = {
href: string;
Expand Down Expand Up @@ -40,9 +40,7 @@ const PublicationSidebarNavLinkItem = ({
function PublicationSidebarNavLinks(props: IPublicationSidebarNavLinks) {
const { currentActiveMenuItemId, isHome, isBadge, enabledPages, navbarItems } = props;
const isHomePage = !currentActiveMenuItemId && isHome;
const isBadgePage = !currentActiveMenuItemId && isBadge;
const isNewsletterPage = currentActiveMenuItemId && currentActiveMenuItemId === 'newsletter';

return (
<nav className="pb-8">
<PublicationSidebarNavLinkItem
Expand All @@ -66,13 +64,6 @@ function PublicationSidebarNavLinks(props: IPublicationSidebarNavLinks) {
);
})
: null}
{enabledPages?.badges ? (
<PublicationSidebarNavLinkItem
href="/badges"
label="Badges"
isActive={!!isBadgePage}
/>
) : null}
{enabledPages?.newsletter ? (
<PublicationSidebarNavLinkItem
href="/newsletter"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,25 +1,18 @@
import { useEffect, useState, useRef, MutableRefObject } from 'react';
import * as DialogPrimitive from '@radix-ui/react-dialog';

import { useAppContext } from './contexts/appContext';
import PublicationSidebarNavLinks from './publication-sidebar-nav-links';
import PublicationSocialLinks from './publication-social-links';
import PublicationLogo from './publication-logo';
import { CloseSVG } from './icons/svgs';
import CustomScrollArea from './scroll-area';

import { Preferences, Publication, PublicationNavbarItem, User } from '../generated/graphql';
import { PublicationFragment } from '../generated/graphql';
import { twJoin } from 'tailwind-merge';
import { returnFocusToElement, blurActiveFocus, doesPublicationHaveSocialLinks } from '../utils/commonUtils';

type Props = {
publication: Pick<Publication, 'id' | 'title' | 'isTeam' | 'links'> & {
author: Pick<User, 'username' | 'name' | 'profilePicture'>;
} & {
preferences: Pick<Preferences, 'navbarItems' | 'enabledPages' | 'logo' | 'darkMode'> & {
navbarItems: Array<Omit<PublicationNavbarItem, 'series' | 'page'>>;
};
};
publication: Pick<PublicationFragment, 'id' | 'title' | 'isTeam' | 'links' | 'author' | 'preferences'>;
toggleSidebar: () => void;
isHome?: boolean | null;
isBadge?: boolean | null;
Expand Down
Loading

0 comments on commit b1b7490

Please sign in to comment.