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

feat(article): Add MD support #1451

Open
wants to merge 25 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 23 commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
b96c8a6
wip(article): Add MD support
WaDadidou Nov 26, 2024
54af815
wip(article): Shrink content input
WaDadidou Dec 9, 2024
fd54612
wip(article): Handle local images
WaDadidou Dec 10, 2024
78fb7e1
wip(article): Change lib for markdown render
WaDadidou Dec 11, 2024
3ea76d0
wip(article): Fix styles, looks good, remove unused libs, remove Arti…
WaDadidou Dec 11, 2024
271f701
feat(article): Integrate Article MD creation and consultation
WaDadidou Dec 12, 2024
b6ec92f
chore: yarn install
WaDadidou Dec 12, 2024
6408c7a
fix(article): fix CI
WaDadidou Dec 12, 2024
91187c6
fix(article): ArticleMarkdown md consultation, fix also ArticleMapPos…
WaDadidou Dec 12, 2024
d82e7a7
Merge branch 'main' into feat-feed-article-markdown
WaDadidou Dec 12, 2024
28d91d1
Merge branch 'main' into feat-feed-article-markdown
WaDadidou Dec 12, 2024
015b7de
fix(article-md): Instantiate once markdownit
WaDadidou Dec 16, 2024
9c4bf23
fix(article-md): Use new cpt ScreenTitle
WaDadidou Dec 16, 2024
9c42f45
fix(articles): Style ul, style mode buttons, remove ipfs url hack
WaDadidou Dec 18, 2024
1eff178
fix(articles): Show border on article content input
WaDadidou Dec 18, 2024
abae215
chore(articles): Remove useless variable
WaDadidou Dec 18, 2024
af89a05
fix(articles): Few design modifs
WaDadidou Dec 18, 2024
74ad2d9
Merge remote-tracking branch 'origin/main' into feat-feed-article-mar…
WaDadidou Dec 20, 2024
1978419
chore: yarn lint-fix
WaDadidou Dec 20, 2024
0aae569
chore(lauchpad): Use ArticleMarkdown types
WaDadidou Dec 20, 2024
d85401b
fix(article-md): customize styles
WaDadidou Dec 23, 2024
e19e7a8
fix(article-md): fix import
WaDadidou Dec 23, 2024
c2b53ba
fix(article-md): remove marginBottom from blockquote > p:first-child …
WaDadidou Dec 27, 2024
a58719b
fix(article-md): markdown styles in constants, TODOs added
WaDadidou Dec 28, 2024
a1632dd
fix(article-md): Use Element from react-native-render-html
WaDadidou Dec 28, 2024
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
5 changes: 5 additions & 0 deletions assets/icons/eye.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
7 changes: 7 additions & 0 deletions assets/icons/splitted-square.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
7 changes: 6 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,8 @@
"@types/crypto-js": "^4.2.2",
"@types/leaflet": "^1.9.12",
"@types/leaflet.markercluster": "^1.5.4",
"@types/markdown-it-emoji": "^3.0.1",
"@types/markdown-it-footnote": "^3.0.4",
"@types/papaparse": "^5.3.14",
"@types/pluralize": "^0.0.33",
"assert": "^2.1.0",
Expand Down Expand Up @@ -121,6 +123,8 @@
"long": "^5.2.1",
"lottie-react-native": "6.5.1",
"markdown-it": "^14.1.0",
"markdown-it-emoji": "^3.0.0",
"markdown-it-footnote": "^4.0.0",
"merkletreejs": "^0.4.0",
"metamask-react": "^2.4.1",
"moment": "^2.29.4",
Expand Down Expand Up @@ -157,6 +161,7 @@
"react-native-reanimated": "^3.6.2",
"react-native-reanimated-carousel": "4.0.0-alpha.9",
"react-native-reanimated-table": "^0.0.2",
"react-native-render-html": "^6.3.4",
"react-native-safe-area-context": "4.8.2",
"react-native-screens": "~3.29.0",
"react-native-smooth-slider": "^1.3.6",
Expand Down Expand Up @@ -197,7 +202,7 @@
"@types/draft-convert": "^2.1.4",
"@types/draft-js": "^0.11.9",
"@types/html-to-draftjs": "^1.4.0",
"@types/markdown-it": "^13.0.7",
"@types/markdown-it": "^14.1.2",
"@types/node": "^20.9.1",
"@types/react": "~18.2.45",
"@types/react-native-countdown-component": "^2.7.0",
Expand Down
2 changes: 2 additions & 0 deletions packages/components/gradientText/GradientText.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,8 @@ const gradient = (type: GradientType): LinearGradientProps => {
return getMapPostTextGradient(PostCategory.Normal);
case getMapPostTextGradientType(PostCategory.Article):
return getMapPostTextGradient(PostCategory.Article);
case getMapPostTextGradientType(PostCategory.ArticleMarkdown):
return getMapPostTextGradient(PostCategory.Article);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this on purpose ?

Copy link
Collaborator Author

@WaDadidou WaDadidou Dec 28, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since we have a new PostCategory ArticleMarkdown (for now), yes

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I completed the description

Please take attention to that: At the final, we'll have only one Article category, type, view, etc. These stuff will be merged with the actual "Article" stuff, and the mention "Markdown" will be removed in the future

case getMapPostTextGradientType(PostCategory.Video):
return getMapPostTextGradient(PostCategory.Video);
case getMapPostTextGradientType(PostCategory.Picture):
Expand Down
2 changes: 2 additions & 0 deletions packages/components/gradientText/GradientText.web.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,8 @@ const gradient = (type: GradientType) => {
return getMapPostTextGradientString(PostCategory.Normal);
case getMapPostTextGradientType(PostCategory.Article):
return getMapPostTextGradientString(PostCategory.Article);
case getMapPostTextGradientType(PostCategory.ArticleMarkdown):
return getMapPostTextGradientString(PostCategory.Article);
case getMapPostTextGradientType(PostCategory.Video):
return getMapPostTextGradientString(PostCategory.Video);
case getMapPostTextGradientType(PostCategory.Picture):
Expand Down
4 changes: 4 additions & 0 deletions packages/components/socialFeed/Map/Map.web.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -287,6 +287,10 @@ export const Map: FC<MapProps> = ({
<Popup closeButton={false} className="marker-popup">
<PictureMapPost post={marker.post} />
</Popup>
) : marker.post.category === PostCategory.ArticleMarkdown ? (
<Popup closeButton={false} className="marker-popup">
<ArticleMapPost post={marker.post} />
</Popup>
) : marker.post.category === PostCategory.Article ? (
<Popup closeButton={false} className="marker-popup">
<ArticleMapPost post={marker.post} />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,9 @@ export const ArticleMapPost: FC<{
return (
<MapPostWrapper post={post} style={{ minWidth: 185 }}>
<View>
<BrandText style={fontSemibold10}>{title}</BrandText>
<BrandText style={fontSemibold10} numberOfLines={2}>
{title}
</BrandText>
<SpacerColumn size={0.5} />

<Separator color={withAlpha(neutralFF, 0.24)} />
Expand Down
15 changes: 12 additions & 3 deletions packages/components/socialFeed/NewsFeed/LocationButton.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { FC } from "react";
import { ColorValue } from "react-native";
import { ColorValue, StyleProp, ViewStyle } from "react-native";
import { MouseEvent } from "react-native/Libraries/Types/CoreEventTypes";

import locationRefinedSVG from "@/assets/icons/location-refined.svg";
import { SVG } from "@/components/SVG";
Expand All @@ -9,9 +10,17 @@ export const LocationButton: FC<{
onPress: () => void;
color?: ColorValue;
stroke?: ColorValue;
}> = ({ onPress, stroke, color }) => {
style?: StyleProp<ViewStyle>;
onHoverIn?: (event: MouseEvent) => void;
onHoverOut?: (event: MouseEvent) => void;
}> = ({ onPress, stroke, color, style, onHoverIn, onHoverOut }) => {
return (
<CustomPressable onPress={onPress}>
<CustomPressable
onPress={onPress}
style={style}
onHoverIn={onHoverIn}
onHoverOut={onHoverOut}
>
<SVG
source={locationRefinedSVG}
height={20}
Expand Down
7 changes: 7 additions & 0 deletions packages/components/socialFeed/NewsFeed/NewsFeed.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ import { SocialArticleCard } from "../SocialCard/cards/SocialArticleCard";
import { SocialThreadCard } from "../SocialCard/cards/SocialThreadCard";
import { SocialVideoCard } from "../SocialCard/cards/SocialVideoCard";

import { SocialArticleMarkdownCard } from "@/components/socialFeed/SocialCard/cards/SocialArticleMarkdownCard";
import { useMaxResolution } from "@/hooks/useMaxResolution";
import { DeepPartial } from "@/utils/typescript";

Expand Down Expand Up @@ -183,6 +184,12 @@ export const NewsFeed: React.FC<NewsFeedProps> = ({
style={cardStyle}
refetchFeed={refetch}
/>
) : post.category === PostCategory.ArticleMarkdown ? (
<SocialArticleMarkdownCard
post={post}
style={cardStyle}
refetchFeed={refetch}
/>
) : post.category === PostCategory.Video ? (
<SocialVideoCard
post={post}
Expand Down
Loading
Loading