Skip to content

Commit

Permalink
Merge branch 'main' into s3-uploads
Browse files Browse the repository at this point in the history
  • Loading branch information
mattcasey committed Dec 10, 2024
2 parents 6e2bf4a + d16f1e5 commit 2300b39
Show file tree
Hide file tree
Showing 75 changed files with 785 additions and 894 deletions.
2 changes: 2 additions & 0 deletions .env.test.local.example
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,5 @@ FORCE_COLOR=1
REACT_APP_BUILDER_NFT_CONTRACT_ADDRESS=0x1d305a06cb9dbdc32e08c3d230889acb9fe8a4dd
# so that we can load the UI and tests still pass
REACT_APP_WALLETCONNECT_PROJECTID=PLACEHOLDER_WALLETCONNECT_PROJECTID
# Tests should run as scout game webapp
REACT_APP_SCOUTGAME_PLATFORM=webapp
9 changes: 7 additions & 2 deletions apps/scoutgame/__e2e__/profilePage.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,13 @@ test.describe('Profile page', () => {
await utils.loginAsUserId(builder.id);

await page.goto('/scout');
const link = page.locator(`data-test=site-navigation >> [href*="/profile"]`).first();
await link.click();

const userPill = page.locator('data-test=user-menu-pill');
await expect(userPill).toBeVisible();
await userPill.click();
const profileButton = page.locator('data-test=user-profile-button');
await expect(profileButton).toBeVisible();
await profileButton.click();

// Logged in user should be redirected
await page.waitForURL('**/profile*');
Expand Down
3 changes: 1 addition & 2 deletions apps/scoutgame/app/(general)/builders/page.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { getCurrentWeek, validateISOWeek } from '@packages/scoutgame/dates';

import { BuildersPage } from 'components/builders/BuildersPage';
import { BuildersPage } from '@packages/scoutgame-ui/components/builders/BuildersPage';

export default async function Builders({
searchParams
Expand Down
5 changes: 2 additions & 3 deletions apps/scoutgame/app/(general)/layout.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
import { Box } from '@mui/material';
import { Header } from '@packages/scoutgame-ui/components/common/Navigation/Header';
import { StickyFooter } from '@packages/scoutgame-ui/components/common/Navigation/StickyFooter';
import type { ReactNode } from 'react';

import { Header } from 'components/common/Header/Header';
import { StickyFooter } from 'components/layout/StickyFooter';

export default async function Layout({
children
}: Readonly<{
Expand Down
6 changes: 3 additions & 3 deletions apps/scoutgame/app/(general)/scout/page.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { prisma } from '@charmverse/core/prisma-client';
import { MAX_STARTER_PACK_PURCHASES } from '@packages/scoutgame/builderNfts/constants';
import type { StarterPackBuilder } from '@packages/scoutgame/builders/getStarterPackBuilders';
import { getStarterPackBuilders } from '@packages/scoutgame/builders/getStarterPackBuilders';
import type { BuilderInfo } from '@packages/scoutgame/builders/interfaces';
import { currentSeason } from '@packages/scoutgame/dates';
import { getUserFromSession } from '@packages/scoutgame/session/getUserFromSession';
import { safeAwaitSSRData } from '@packages/scoutgame/utils/async';
Expand All @@ -23,7 +23,7 @@ export default async function Scout({

const user = await getUserFromSession();

let builders: BuilderInfo[] = [];
let builders: StarterPackBuilder[] = [];

let remainingStarterCards = MAX_STARTER_PACK_PURCHASES;

Expand All @@ -38,7 +38,7 @@ export default async function Scout({
remainingStarterCards = MAX_STARTER_PACK_PURCHASES - purchases;

if (purchases < MAX_STARTER_PACK_PURCHASES) {
const [_, starterPackBuilders] = await safeAwaitSSRData(getStarterPackBuilders());
const [_, starterPackBuilders] = await safeAwaitSSRData(getStarterPackBuilders({ userId: user?.id }));
builders = starterPackBuilders ?? [];
}
}
Expand Down
3 changes: 1 addition & 2 deletions apps/scoutgame/app/api/connect-github/get-link/route.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { getGithubOAuthCallbackUrl } from '@packages/github/oauth';
import { getSession } from '@packages/scoutgame/session/getSession';
import { authSecret } from '@root/config/constants';
import { GITHUB_CLIENT_ID } from '@root/lib/github/constants';
import { authSecret, GITHUB_CLIENT_ID } from '@packages/utils/constants';
import { sealData } from 'iron-session';
import type { NextRequest } from 'next/server';

Expand Down

This file was deleted.

18 changes: 13 additions & 5 deletions apps/scoutgame/components/scout/ScoutPage.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import AppsIcon from '@mui/icons-material/Apps';
import FormatListBulletedIcon from '@mui/icons-material/FormatListBulleted';
import { Box, Grid2 as Grid, Stack, Typography } from '@mui/material';
import type { StarterPackBuilder } from '@packages/scoutgame/builders/getStarterPackBuilders';
import type { BuilderInfo } from '@packages/scoutgame/builders/interfaces';
import { HeaderMessage } from '@packages/scoutgame-ui/components/common/Header/HeaderMessage';
import { TabsMenu, type TabItem } from '@packages/scoutgame-ui/components/common/Tabs/TabsMenu';
Expand Down Expand Up @@ -34,7 +35,8 @@ export function ScoutPage({
buildersLayout,
tab,
starterpackBuilders,
remainingStarterCards
remainingStarterCards,
userId
}: {
scoutSort: string;
builderSort: string;
Expand All @@ -43,8 +45,9 @@ export function ScoutPage({
scoutTab: string;
buildersLayout: string;
tab: string;
starterpackBuilders: BuilderInfo[];
starterpackBuilders: StarterPackBuilder[];
remainingStarterCards?: number;
userId?: string;
}) {
const urlString = Object.entries({ tab, scoutSort, builderSort, scoutOrder, builderOrder })
.filter(([, value]) => isTruthy(value))
Expand All @@ -56,7 +59,6 @@ export function ScoutPage({
<HeaderMessage />
<Grid
container
spacing={1}
height={{
md: 'calc(100vh - 100px)',
xs: 'calc(100vh - 160px)'
Expand All @@ -68,7 +70,7 @@ export function ScoutPage({
sx={{
height: '100%',
overflowX: 'hidden',
p: 2,
p: 1,
gap: 2
}}
>
Expand Down Expand Up @@ -148,7 +150,13 @@ export function ScoutPage({
</Grid>
<Grid
size={4}
sx={{ height: '100%', overflowY: 'auto', overflowX: 'hidden', display: { xs: 'none', md: 'block' } }}
sx={{
height: '100%',
overflowY: 'auto',
overflowX: 'hidden',
display: { xs: 'none', md: 'block' },
px: 1
}}
>
<Box sx={{ position: 'sticky', top: 0, zIndex: 1, backgroundColor: 'background.default' }}>
<TabsMenu value={scoutTab} tabs={scoutTabOptions} queryKey='scoutTab' />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,10 +77,10 @@ export function BuildersGalleryContainer({
return (
<>
<BuildersGallery builders={builders} showHotIcon={showHotIcon} size={isDesktop ? 'large' : 'small'} columns={3} />
{nextCursor && <div ref={observerTarget} style={{ height: '20px', width: '100%' }} />}
{nextCursor && <div ref={observerTarget} style={{ height: '50px', width: '100%' }} />}
{isLoading && (
<Box my={2}>
<LoadingCards />
<LoadingCards count={3} />
</Box>
)}
{error && <Alert severity='error'>{error}</Alert>}
Expand Down
11 changes: 0 additions & 11 deletions apps/scoutgame/hooks/api/session.ts

This file was deleted.

13 changes: 9 additions & 4 deletions apps/scoutgame/lib/builders/getPaginatedBuilders.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,14 +32,19 @@ export async function getPaginatedBuilders({
},
week
},
orderBy: {
rank: 'asc'
},
orderBy: [
{
rank: 'asc'
},
{
userId: 'asc'
}
],
skip: cursor ? 1 : 0,
take: limit,
cursor: cursor
? {
rank: cursor.rank,
rank: cursor.rank === -1 ? null : cursor.rank,
userId_week: {
userId: cursor.userId,
week
Expand Down
4 changes: 1 addition & 3 deletions apps/scoutgame/scripts/query.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
import { prisma } from '@charmverse/core/prisma-client';

import { getLeaderboard } from 'lib/builders/getLeaderboard';
import { getLeaderboard } from '@packages/scoutgame/builders/getLeaderboard';
import { getTopScoutsByWeek } from 'lib/scouts/getTopScouts';
import { getWeekStartEndFormatted, getDateFromISOWeek } from '@packages/scoutgame/dates';
async function query() {
Expand Down
13 changes: 13 additions & 0 deletions apps/scoutgametelegram/app/(general)/builders/page.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import { getCurrentWeek, validateISOWeek } from '@packages/scoutgame/dates';
import { BuildersPage } from '@packages/scoutgame-ui/components/builders/BuildersPage';

export default async function Builders({
searchParams
}: {
searchParams: { [key: string]: string | string[] | undefined };
}) {
const tab = (searchParams.tab as string) || 'leaderboard';
const week = searchParams.week as string | undefined;

return <BuildersPage tab={tab} week={week && validateISOWeek(week) ? week : getCurrentWeek()} />;
}
Loading

0 comments on commit 2300b39

Please sign in to comment.