-
Notifications
You must be signed in to change notification settings - Fork 78
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'develop' into sero/what-we-do
- Loading branch information
Showing
24 changed files
with
838 additions
and
199 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
/** | ||
* Quest Article CSS | ||
* The typography for the quest description is different to the standard withProse/Markdown | ||
* ref: https://www.figma.com/file/2yEeQUrgPOrLOq6DpC6Mb7/Quests-UI?node-id=519-2199&t=f7ABDY7Dw2Yxtrsc-0 | ||
* | ||
* Main things | ||
* - Block elements have bottom margins but no top margin / The margins are tighter | ||
* - The font sizes are larger | ||
*/ | ||
|
||
export const questArticleCss = { | ||
'.mg-article-typography': { | ||
// Basic coverage | ||
fontSize: 'var(--chakra-fontSizes-xl)', | ||
lineHeight: '1.4', | ||
|
||
// Margins/font-size for main block elements that might be in the article | ||
'address, aside, blockquote, details, dl, figure, form, ol, p, pre, section, table, ul': | ||
{ | ||
fontSize: 'var(--chakra-fontSizes-xl)', | ||
lineHeight: '1.4', | ||
marginBottom: 'var(--chakra-space-8)', | ||
marginTop: '0', | ||
}, | ||
|
||
summary: { | ||
fontSize: 'var(--chakra-fontSizes-2xl)', | ||
cursor: 'pointer', | ||
}, | ||
|
||
// Specific to headings | ||
// Includes HHH-GH being opinionated with the marginTop | ||
'h1, h2, h3, h4, h5, h6': { | ||
marginTop: 'var(--chakra-space-12)', // extra space between heading and preceding content ... | ||
marginBottom: 'var(--chakra-space-8)', | ||
}, | ||
'h1:first-of-type, h2:first-of-type, h3:first-of-type, h4:first-of-type, h5:first-of-type, h6:first-of-type': | ||
{ | ||
marginTop: '0', // ... unless it's the first one | ||
}, | ||
|
||
':is(h1, h2, h3, h4, h5, h6) + :is(h1, h2, h3, h4, h5, h6)': { | ||
marginTop: '0', // ... or if two headings are adjacent | ||
}, | ||
'h1, h2': { | ||
fontSize: 'var(--chakra-fontSizes-4xl)', | ||
}, | ||
h3: { | ||
fontSize: 'var(--chakra-fontSizes-3xl)', | ||
}, | ||
'h4, h5, h6': { | ||
fontSize: 'var(--chakra-fontSizes-xl)', | ||
}, | ||
}, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
import { Box, Heading, Link, Prose, Text } from '@metafam/ds'; | ||
import { isSGML } from '@metafam/utils'; | ||
import { MarkdownViewer as Markdown } from 'components/MarkdownViewer'; | ||
import { QuestFragment } from 'graphql/autogen/types'; | ||
import React from 'react'; | ||
import { safelyParseNChakrifyHtml } from 'utils/stringHelpers'; | ||
|
||
type Props = { | ||
quest: QuestFragment; | ||
}; | ||
|
||
export const QuestDetailsDescription: React.FC<Props> = ({ quest }) => { | ||
const descIsHtml = isSGML(quest.description ?? ''); | ||
const parsedDescription = descIsHtml | ||
? safelyParseNChakrifyHtml(quest.description ?? '') | ||
: null; | ||
|
||
return ( | ||
<Box className="mg-article-typography"> | ||
{descIsHtml ? ( | ||
<Prose>{parsedDescription}</Prose> | ||
) : ( | ||
<Markdown>{quest.description}</Markdown> | ||
)} | ||
</Box> | ||
); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,110 @@ | ||
import { | ||
Box, | ||
Button, | ||
Flex, | ||
Heading, | ||
MetaButton, | ||
Stack, | ||
Text, | ||
VStack, | ||
} from '@metafam/ds'; | ||
import { MetaLink } from 'components/Link'; | ||
import { PlayerAvatar } from 'components/Player/PlayerAvatar'; | ||
import { Quest, QuestFragment, QuestStatus_Enum } from 'graphql/autogen/types'; | ||
import { useUser } from 'lib/hooks'; | ||
import { usePlayerName } from 'lib/hooks/player/usePlayerName'; | ||
import { usePlayerURL } from 'lib/hooks/player/usePlayerURL'; | ||
import React from 'react'; | ||
|
||
import { RepetitionTag, StatusTag } from './QuestTags'; | ||
|
||
type Props = { | ||
quest: QuestFragment; | ||
}; | ||
|
||
export const QuestDetailsHeader: React.FC<Props> = ({ quest }) => { | ||
const playerName = usePlayerName(quest.player); | ||
const playerProfileLinkURL = usePlayerURL(quest.player); | ||
const { user } = useUser(); | ||
const isMyQuest = user?.id === (quest as Quest).player.id; | ||
const { | ||
repetition, | ||
cooldown, | ||
// createdAt, | ||
// externalLink: link, | ||
title, | ||
status, | ||
} = quest; | ||
|
||
return ( | ||
<Flex | ||
as="header" | ||
alignItems="center" | ||
flexDirection={{ | ||
base: 'column', | ||
md: 'row', | ||
}} | ||
gap={6} | ||
mb={[8, 8, 12]} | ||
> | ||
<Box w="full" flexBasis="100%"> | ||
<Heading | ||
as="h1" | ||
fontFamily="body" | ||
fontWeight="600" | ||
fontSize={{ base: '5xl', md: '8xl' }} | ||
mb={5} | ||
> | ||
{title} | ||
</Heading> | ||
|
||
<Flex | ||
gap={2} | ||
fontSize="2xl" | ||
lineHeight="1.1" | ||
alignItems="flex-start" | ||
mb={5} | ||
> | ||
<Text as="div" fontWeight="400" whiteSpace="nowrap"> | ||
Created by | ||
</Text> | ||
|
||
<Flex alignItems="flex-start" gap={2}> | ||
<PlayerAvatar player={quest.player} size="sm" /> | ||
|
||
<Text | ||
wordBreak="break-all" /* in case of really long usernames or an ETH address as username */ | ||
> | ||
<MetaLink href={playerProfileLinkURL}>{playerName}</MetaLink> | ||
</Text> | ||
</Flex> | ||
</Flex> | ||
|
||
<Flex gap={2}> | ||
<StatusTag status={status} /> | ||
<RepetitionTag {...{ repetition, cooldown }} /> | ||
</Flex> | ||
</Box> | ||
|
||
{/* Edit button is displayed to the Quest Owner */} | ||
{isMyQuest && status === QuestStatus_Enum.Open && ( | ||
<Box w="full" maxW={{ base: '100%', md: '12rem' }}> | ||
{/* Stacked vertically after md breakpoint */} | ||
<Stack spacing={5} direction={{ base: 'row', md: 'column' }}> | ||
<Button | ||
as="a" // so it can be used as a link | ||
href={`/quest/${quest.id}/edit`} | ||
variant="outline" | ||
borderWidth={2} | ||
size="lg" | ||
fontSize="md" | ||
w="full" | ||
> | ||
Edit quest | ||
</Button> | ||
</Stack> | ||
</Box> | ||
)} | ||
</Flex> | ||
); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import { AspectRatio, Image } from '@metafam/ds'; | ||
import React from 'react'; | ||
|
||
type Props = { | ||
src: string; | ||
}; | ||
|
||
export const QuestDetailsImage: React.FC<Props> = ({ src }) => ( | ||
<AspectRatio | ||
ratio={{ | ||
base: 1 / 1, | ||
md: 4 / 3, | ||
}} | ||
> | ||
<Image src={src} alt="" borderRadius={10} fit="cover" /> | ||
</AspectRatio> | ||
); |
Oops, something went wrong.