Skip to content

Commit

Permalink
feat: show cards without xp
Browse files Browse the repository at this point in the history
feat: show cards without xp
  • Loading branch information
tcheee authored Sep 9, 2024
2 parents 89837b9 + 566e70d commit 1a3898d
Show file tree
Hide file tree
Showing 12 changed files with 29 additions and 30 deletions.
10 changes: 0 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,13 +64,3 @@ Register on Crowdin and you can start translating the project into your preferre
Your contributions will help make our project accessible to a wider audience around the world.

Thank you for your support!

## Code info

### NextThemeProvider

provider for the theme context, it is used to provide the theme to the whole app, must be into the layout.tsx or page.tsx.

### ThemeProviderV2

provider for the MUI theme context, mainly setting up the MUI provider, very linked to the next-theme provider
1 change: 1 addition & 0 deletions src/app/[lng]/(main)/layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ export default async function MainLayout({

const defaultTheme = 'default';

// provider for the theme context, it is used to provide the theme to the whole app, must be into the layout.tsx or page.tsx.
return (
<NextThemeProvider
themes={[
Expand Down
2 changes: 1 addition & 1 deletion src/app/[lng]/quests/layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ export default async function PartnerThemeLayout({
enableSystem
enableColorScheme
>
<ThemeProviderV2>
<ThemeProviderV2 themes={[]}>
<Layout>{children}</Layout>
</ThemeProviderV2>
</NextThemeProvider>
Expand Down
2 changes: 1 addition & 1 deletion src/app/[lng]/scan/layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ export default async function PartnerThemeLayout({
enableSystem
enableColorScheme
>
<ThemeProviderV2>
<ThemeProviderV2 themes={[]}>
<Layout>{children}</Layout>
</ThemeProviderV2>
</NextThemeProvider>
Expand Down
1 change: 0 additions & 1 deletion src/components/ProfilePage/Rewards/RewardsCarousel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,6 @@ export const RewardsCarousel = ({
return (
<>
{!hideComponent ? (
// && rewardAmount && rewardAmount > 0
<RewardsCarouselContainer>
<RewardsCarouselMainBox>
<FlexCenterRowBox>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import { DescriptionBoxSF } from './DescriptionBoxSF/DescriptionBoxSF';
import { InformationAlertBox } from './InformationBox/InformationAlertBox';
import { StepsBox } from './StepsBox/StepsBox';
import { SuperfestPageMainBox } from './SuperfestMissionPage.style';
import { notFound } from 'next/navigation';

interface SuperfestMissionPageVar {
quest: Quest;
Expand Down Expand Up @@ -45,6 +46,10 @@ export const SuperfestMissionPage = ({
});
const { CTAsWithAPYs } = useMissionsAPY(CTAs);

if (!quest) {
return notFound();
}

return (
<SuperfestContainer className="superfest">
<SuperfestPageMainBox>
Expand Down
2 changes: 1 addition & 1 deletion src/components/Widgets/Widget.types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,5 +33,5 @@ export interface WidgetProps extends Omit<BlogWidgetProps, 'allowChains'> {
widgetIntegrator?: string;
starterVariant: StarterVariantType;
activeThemeMode?: ThemeModesSupported;
activeTheme?: any; // TODO: Fix it
activeTheme?: string;
}
2 changes: 1 addition & 1 deletion src/hooks/useOngoingQuests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ export const useOngoingQuests = (): UseQuestsProps => {
apiUrl.searchParams.set('sort[0]', 'id:desc');
//filter url
apiUrl.searchParams.set('pagination[pageSize]', '50');
apiUrl.searchParams.set('filters[Points][$gte]', '0');
// apiUrl.searchParams.set('filters[Points][$gte]', '0');
const currentDate = new Date(Date.now()).toISOString().split('T')[0];
apiUrl.searchParams.set('filters[StartDate][$lte]', currentDate);
apiUrl.searchParams.set('filters[EndDate][$gte]', currentDate);
Expand Down
22 changes: 16 additions & 6 deletions src/providers/ThemeProviderV2.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,17 +9,18 @@ import {
import { CssBaseline } from '@mui/material';
import { ThemeProvider as MuiThemeProvider } from '@mui/material/styles';
import { deepmerge } from '@mui/utils';
import type { PartnerThemesData } from '@/types/strapi';
import { useTheme } from 'next-themes';
import { useEffect, useState } from 'react';
import { useCookies } from 'react-cookie';
import { darkTheme, lightTheme } from 'src/theme';

function getPartnerTheme(themes: any[], activeTheme: string) {
function getPartnerTheme(themes: PartnerThemesData[], activeTheme?: string) {
return themes?.find((d) => d.attributes.uid === activeTheme)?.attributes;
}

function getMuiTheme(themes: any[], activeTheme: string) {
if (['dark', 'system'].includes(activeTheme)) {
function getMuiTheme(themes: PartnerThemesData[], activeTheme?: string) {
if (activeTheme && ['dark', 'system'].includes(activeTheme)) {
return darkTheme;
} else if (activeTheme === 'light') {
return lightTheme;
Expand All @@ -39,17 +40,26 @@ function getMuiTheme(themes: any[], activeTheme: string) {
return deepmerge(baseTheme, formattedTheme.activeMUITheme);
}

interface ThemeProviderV2Props {
children: React.ReactNode;
activeTheme?: string;
themes: PartnerThemesData[];
}

/**
* Your app's theme provider component.
* 'use client' is essential for next-themes to work with app-dir.
* provider for the MUI theme context, mainly setting up the MUI provider, very linked to the next-theme provider
*/
export function ThemeProviderV2({ children, activeTheme, themes }: any) {
export function ThemeProviderV2({
children,
activeTheme,
themes,
}: ThemeProviderV2Props) {
const { resolvedTheme, forcedTheme, ...props2 } = useTheme();
const [cookie, setCookie] = useCookies(['theme']);
const [partnerThemes, setPartnerThemes] = useSettingsStore((state) => [
state.partnerThemes,
state.setPartnerThemes,
state.setActiveTheme,
]);
const [configTheme, setConfigTheme] = useSettingsStore((state) => [
state.configTheme,
Expand Down
5 changes: 0 additions & 5 deletions src/stores/settings/SettingsStore.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,6 @@ export const useSettingsStore = createWithEqualityFn(
...defaultSettings,

// Mode
setActiveTheme: (activeTheme: string) => {
set({
activeTheme: activeTheme,
});
},
setConfigTheme: (configTheme: PartnerThemeConfig) => {
set({
configTheme,
Expand Down
5 changes: 2 additions & 3 deletions src/types/settings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,8 @@ export interface SettingsState extends SettingsProps {
// Mode
setThemeMode: (mode: ThemeModesSupported) => void;

setActiveTheme: (activeTheme: any) => void;
setConfigTheme: (configTheme: any) => void;
setWidgetTheme: (widgetTheme: any) => void;
setConfigTheme: (configTheme: Partial<PartnerThemeConfig>) => void;
setWidgetTheme: (widgetTheme: { config: Partial<WidgetConfig> }) => void; // maybe config

// Installed Wallets
setClientWallets: (wallet: string) => void;
Expand Down
2 changes: 1 addition & 1 deletion src/utils/formatTheme.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ function getLogoData(theme: PartnerThemesAttributes) {
}

export function formatConfig(
theme: PartnerThemesAttributes,
theme?: PartnerThemesAttributes,
): Partial<PartnerThemeConfig> {
if (!theme) {
return {
Expand Down

0 comments on commit 1a3898d

Please sign in to comment.