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

chore: Remove veda dependency #1398

Merged
merged 3 commits into from
Jan 23, 2025
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
3 changes: 2 additions & 1 deletion app/scripts/components/common/layout-root/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,12 @@ import styled from 'styled-components';
import { Outlet } from 'react-router';
import { reveal } from '@devseed-ui/animation';
import { NavLink } from 'react-router-dom';

import {
getBannerFromVedaConfig,
getCookieConsentFromVedaConfig,
getSiteAlertFromVedaConfig
} from 'veda';
import { footerSettings } from '../page-footer/default-config';
import MetaTags from '../meta-tags';
import PageFooter from '../page-footer';
import PageFooterLegacy from '../page-footer-legacy';
Expand Down Expand Up @@ -120,6 +120,7 @@ function LayoutRoot(props: { children?: ReactNode }) {
hideFooter={hideFooter}
linkProperties={{ LinkElement: NavLink, pathAttributeKeyName: 'to' }}
logoSvg={<NasaLogoColor />}
footerSettings={footerSettings}
/>
) : (
<PageFooterLegacy hideFooter={hideFooter} />
Expand Down
15 changes: 15 additions & 0 deletions app/scripts/components/common/page-footer/footer.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,18 @@ import { NavItem } from '../page-header/types.js';

import PageFooter from './index';

const defaultFooterSetting = {
secondarySection: {
division: 'NASA EarthData 2024',
version: 'BETA VERSION',
title: 'NASA Official',
name: 'Manil Maskey',
to: '[email protected]',
type: 'email'
},
returnToTop: true
};

const mockMainNavItems: NavItem[] = navItems.mainNavItems;
const mockSubNavItems: NavItem[] = navItems.subNavItems;
// const mockFooterSettings = footerSettings;
Expand Down Expand Up @@ -40,6 +52,7 @@ describe('PageFooter', () => {
hideFooter={hideFooter}
logoSvg={<NasaLogoColor />}
linkProperties={mockLinkProperties}
footerSettings={defaultFooterSetting}
/>
);
const footerElement = document.querySelector('footer');
Expand All @@ -56,6 +69,7 @@ describe('PageFooter', () => {
hideFooter={hideFooter}
logoSvg={<NasaLogoColor />}
linkProperties={mockLinkProperties}
footerSettings={defaultFooterSetting}
/>
);
expect(screen.getByText('Data Catalog')).toBeInTheDocument();
Expand Down Expand Up @@ -89,6 +103,7 @@ describe('PageFooter dynamic settings', () => {
subNavItems={mockSubNavItems}
hideFooter={true}
logoSvg={<NasaLogoColor />}
footerSettings={defaultFooterSetting}
/>
);
const footerElement = document.querySelector('footer');
Expand Down
16 changes: 13 additions & 3 deletions app/scripts/components/common/page-footer/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import { DropdownNavLink, NavLinkItem } from '../types';
import { ActionNavItem, NavItemType } from '../page-header/types';
import { NavItemCTA } from '../page-header/nav/nav-item-cta';
import ReturnToTopButton from './return-to-top-button';
import { footerSettings } from './default-config';

import { LinkProperties } from '$types/veda';
import {
Expand All @@ -19,15 +18,26 @@ interface PageFooterProps {
hideFooter?: boolean;
logoSvg?: SVGElement | JSX.Element;
linkProperties: LinkProperties;
footerSettings: {
secondarySection: {
division: string;
version: string;
title: string;
name: string;
to: string;
type: string;
};
returnToTop: boolean;
};
}


export default function PageFooter({
mainNavItems,
subNavItems,
hideFooter,
logoSvg,
linkProperties
linkProperties,
footerSettings
}: PageFooterProps) {
const { returnToTop, secondarySection } = footerSettings;
const FooterNavItemInternalLink = (item) => {
Expand Down
1 change: 1 addition & 0 deletions app/scripts/components/common/page-header/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { NavItem } from './types';
import LogoContainer from './logo-container';
import useMobileMenuFix from './use-mobile-menu-fix';
import { createDynamicNavMenuList } from './nav/create-dynamic-nav-menu-list';

import {
USWDSHeader,
USWDSHeaderTitle,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
import React from 'react';
import GoogleForm from '../../google-form';
import { useFeedbackModal } from '../../layout-root';
import { ActionNavItem } from '../types';
import { useDisplay } from '$utils/use-display';

interface NavItemCTAProps {
item: ActionNavItem;
customClasses?: string;
}

export const NavItemCTA = ({ item, customClasses }: NavItemCTAProps) => {
const { isRevealed, show, hide } = useFeedbackModal();
const { isRevealed, show, hide } = useDisplay();

return (
<React.Fragment key={item.id}>
{item.actionId === 'open-google-form' && (
Expand Down
1 change: 0 additions & 1 deletion app/scripts/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ import type {
import type { InternalNavLink } from '$components/common/types';
import type { DatasetData, StoryData, VedaData } from '$types/veda';


import ExplorationAndAnalysis from '$components/exploration';
import useTimelineDatasetAtom from '$components/exploration/hooks/use-timeline-dataset-atom';
import { timelineDatasetsAtom } from '$components/exploration/atoms/datasets';
Expand Down
11 changes: 11 additions & 0 deletions app/scripts/utils/use-display.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import { useCallback, useState } from 'react';

export function useDisplay() {
const [display, setDisplay] = useState<boolean>(false);

return {
isRevealed: display,
show: useCallback(() => setDisplay(true), [setDisplay]),
hide: useCallback(() => setDisplay(false), [setDisplay])
};
}
Loading