Skip to content
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 changes: 2 additions & 0 deletions packages/webapp/components/KeywordManagement.spec.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import {
import type { FeedData } from '@dailydotdev/shared/src/graphql/feed';
import { KEYWORD_FEED_QUERY } from '@dailydotdev/shared/src/graphql/feed';
import type { Post } from '@dailydotdev/shared/src/graphql/posts';
import { PostType } from '@dailydotdev/shared/src/graphql/posts';
import type { Connection } from '@dailydotdev/shared/src/graphql/common';
import type { MockedGraphQLResponse } from '@dailydotdev/shared/__tests__/helpers/graphql';
import { mockGraphQL } from '@dailydotdev/shared/__tests__/helpers/graphql';
Expand Down Expand Up @@ -39,6 +40,7 @@ const defaultFeedPage: Connection<Post> = {
node: {
id: '0e4005b2d3cf191f8c44c2718a457a1e',
title: 'Learn SQL',
type: PostType.Article,
image:
'https://media.daily.dev/image/upload/f_auto,q_auto/v1/posts/22fc3ac5cc3fedf281b6e4b46e8c0ba2',
commentsPermalink: 'https://localhost:5002/posts/9CuRpr5NiEY5',
Expand Down
2 changes: 1 addition & 1 deletion packages/webapp/components/PostSEOSchema.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -367,7 +367,7 @@ export interface PostSEOSchemaProps {
export const PostSEOSchema = ({
post,
topComments,
}: PostSEOSchemaProps): ReactElement => {
}: PostSEOSchemaProps): ReactElement | null => {
if (!post) {
return null;
}
Expand Down
2 changes: 1 addition & 1 deletion packages/webapp/components/ProtectedPage.spec.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ describe('ProtectedPage', () => {
render(
<AuthContext.Provider
value={{
user: null,
user: undefined,
isAuthReady: true,
isFetched: true,
isLoggedIn: false,
Expand Down
2 changes: 1 addition & 1 deletion packages/webapp/components/footer/FooterPlusButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ export function FooterPlusButton({
className,
}: FooterPlusButtonProps): ReactElement {
const { user } = useAuthContext();
const drawerRef = useRef<DrawerRef>();
const drawerRef = useRef<DrawerRef>(null);
const [isDrawerOpen, setIsDrawerOpen] = useState(false);
const props = user
? { onClick: () => setIsDrawerOpen(true) }
Expand Down
8 changes: 6 additions & 2 deletions packages/webapp/components/footer/common.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,12 @@ export interface FooterNavBarContainerProps {
export const getNavPath = (
path: FooterTab['path'],
user: LoggedUser,
): string => {
return typeof path === 'string' ? path : path(user);
): string | undefined => {
if (typeof path === 'string') {
return path;
}

return path?.(user);
};

export const blurClasses = 'bg-blur-baseline backdrop-blur-[2.5rem]';
2 changes: 1 addition & 1 deletion packages/webapp/components/history/reading.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ export function ReadingHistory(): ReactElement {
/>
{hasData && (
<ReadingHistoryList
data={data}
data={data!}
onHide={hideReadHistory}
infiniteScrollRef={infiniteScrollRef}
/>
Expand Down
2 changes: 1 addition & 1 deletion packages/webapp/components/invite/Referral.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ export function Referral({

useEffect(() => {
if (isLoggedIn) {
router.push(redirectTo);
router.push(redirectTo ?? '/');
}

// router is an unstable dependency
Expand Down
2 changes: 1 addition & 1 deletion packages/webapp/components/layouts/CoresLayout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import type { MainFeedPageProps } from './MainFeedPage';

export default function CoresLayout({
children,
}: MainFeedPageProps): ReactElement {
}: MainFeedPageProps): ReactElement | null {
const isMobile = useViewSizeClient(ViewSize.MobileL);
const { back, replace, push, isReady } = useRouter();
const { user, isAuthReady } = useAuthContext();
Expand Down
2 changes: 1 addition & 1 deletion packages/webapp/components/layouts/MainFeedPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ export default function MainFeedPage({
const [feedName, setFeedName] = useState(
getInternalFeedName(router?.pathname, { isMyFeed: isMyFeedURL }),
);
const [isSearchOn, setIsSearchOn] = useState(isFinderPage);
const [isSearchOn, setIsSearchOn] = useState(!!isFinderPage);
useEffect(() => {
const isMyFeed = router?.pathname === '/my-feed';
if (getShouldRedirect(isMyFeed, !!user)) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import { webappUrl } from '@dailydotdev/shared/src/lib/constants';
import { LogoWithPlus } from '@dailydotdev/shared/src/components/Logo';
import { useViewSize, ViewSize } from '@dailydotdev/shared/src/hooks';

export const PlusHeader = (): ReactElement => {
export const PlusHeader = (): ReactElement | null => {
const isMobile = useViewSize(ViewSize.MobileL);
const { back, replace, isReady } = useRouter();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import { PlusHeader } from './PlusHeader';

export default function PlusLayout({
children,
}: MainFeedPageProps): ReactElement {
}: MainFeedPageProps): ReactElement | null {
const { user, isAuthReady } = useAuthContext();
const { growthbook } = useGrowthBookContext();
const router = useRouter();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ export const DevCardStep1 = ({ onGenerateImage }: Step1Props): ReactElement => {

return (
<div className="flex flex-col items-center">
<DevCardPlaceholder profileImage={user.image} />
<DevCardPlaceholder profileImage={user!.image} />
<Typography bold tag={TypographyTag.H1} type={TypographyType.Title1}>
Generate your DevCard
</Typography>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import { getSettingsLayout } from '.';
export const FeedSettingsLayout = ({ children }: PropsWithChildren) => {
const { user } = useAuthContext();
const feedSettingsEditContext = useFeedSettingsEdit({
feedSlugOrId: user.id,
feedSlugOrId: user!.id,
});
return (
<FeedSettingsEditContext.Provider value={feedSettingsEditContext}>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ function AccountLoginSection({
children,
className,
buttonVariant = ButtonVariant.Primary,
}: AccountLoginSectionProps): ReactElement {
}: AccountLoginSectionProps): ReactElement | null {
if (!providers?.length) {
return null;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ export const CommonTextField = classed(TextField, { container: 'max-w-sm' });
export const AccountTextField = classed(CommonTextField, { container: 'mt-6' });

type SettingsSwitchProps = {
name?: string;
name: string;
children: ReactNode;
checked: boolean;
onToggle: () => void;
Expand Down
2 changes: 1 addition & 1 deletion packages/webapp/hooks/useWebappVersion.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ const getVersion = (query: ParsedUrlQuery): string | undefined => {
return undefined;
};

export default function useWebappVersion(): string {
export default function useWebappVersion(): string | undefined {
const { query } = useRouter();
const [version, setVersion] = useState<string>();

Expand Down
1 change: 1 addition & 0 deletions packages/webapp/lib/gameCenter.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ describe('game center helpers', () => {
xpInLevel: 150,
xpToNextLevel: 250,
},
hasNewQuestRotations: false,
currentStreak: 4,
longestStreak: 9,
daily: {
Expand Down
2 changes: 1 addition & 1 deletion packages/webapp/pages/agents/ask/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ const AskPage = (): ReactElement => {
color={ButtonColor.Avocado}
size={ButtonSize.Large}
icon={<DevPlusIcon />}
onClick={(e) => {
onClick={(e: React.MouseEvent) => {
if (!isLoggedIn) {
e.preventDefault();
showLogin({ trigger: AuthTriggers.Plus });
Expand Down
2 changes: 1 addition & 1 deletion packages/webapp/pages/settings/api.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -673,7 +673,7 @@ const ApiAccessPage = (): ReactElement => {
multiline={method.multilineCode}
onCopy={() =>
handleCopy(
method.copyValue,
method.copyValue!,
method.copySuccessMessage,
)
}
Expand Down
2 changes: 1 addition & 1 deletion packages/webapp/pages/settings/customization/devcard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ const seo: NextSeoProps = {
},
};

const Page = (): ReactElement => {
const Page = (): ReactElement | null => {
const { completeAction, checkHasCompleted, isActionsFetched } = useActions();
const { user, loadingUser } = useAuthContext();
const isDevCardGenerated = checkHasCompleted(ActionType.DevCardGenerate);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import { defaultSeo } from '../../../next-seo';
import { getTemplatedTitle } from '../../../components/layouts/utils';
import { SettingsSwitch } from '../../../components/layouts/SettingsLayout/common';

const GamificationSettingsPage = (): ReactElement => {
const GamificationSettingsPage = (): ReactElement | null => {
const router = useRouter();
const {
optOutLevelSystem,
Expand Down
2 changes: 1 addition & 1 deletion packages/webapp/pages/settings/privacy.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ const seo: NextSeoProps = {
...getPageSeoTitles('Privacy'),
};

const AccountInvitePage = (): ReactElement => {
const AccountInvitePage = (): ReactElement | null => {
const router = useRouter();
const { saveCookies } = useConsentCookie(GdprConsentKey.Marketing);
const { user, isAuthReady, isGdprCovered } = useAuthContext();
Expand Down
2 changes: 1 addition & 1 deletion packages/webapp/pages/squads/discover/my.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ import { mainFeedLayoutProps } from '../../../components/layouts/MainFeedPage';
import { SquadDirectoryLayout } from '../../../../shared/src/components/squads/layout/SquadDirectoryLayout';
import { defaultSeo } from '../../../next-seo';

function MySquadsPage(): ReactElement {
function MySquadsPage(): ReactElement | null {
const { count, isModeratorInAnySquad } = useSquadPendingPosts();
const { squads } = useAuthContext();
const router = useRouter();
Expand Down
2 changes: 1 addition & 1 deletion packages/webapp/pages/squads/new.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ const NewSquad = (): ReactElement => {
await onSave({
channelId: selectedChannel,
integrationId,
sourceId: squad.id,
sourceId: squad.id!,
});
}

Expand Down
Loading