Skip to content

Commit a9eae10

Browse files
authored
Merge pull request #128 from medyo/develop
new version
2 parents 82bb9bd + b91f1f6 commit a9eae10

39 files changed

Lines changed: 668 additions & 163 deletions

File tree

.github/workflows/distribute.yml

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,9 @@ on:
99
default: 'all'
1010
type: choice
1111
options:
12-
- chrome
13-
- firefox
14-
- all
12+
- chrome
13+
- firefox
14+
- all
1515
autoTag:
1616
description: 'Auto Create a new tag'
1717
required: true
@@ -38,6 +38,8 @@ jobs:
3838
with:
3939
github_token: ${{ secrets.GITHUB_TOKEN }}
4040
dry_run: ${{ github.event.inputs.autoTag == 'false' }}
41+
custom_release_rules: |
42+
"fix:patch:Bug Fixes,hotfix:patch:Bug Fixes,refactor:minor:Refactoring,implement:minor:Features,change:minor:Changes,breaking:major:Breaking Changes,major:major:Major Changes"
4143
4244
- name: Update manifest.json
4345
if: github.event.inputs.autoTag == 'true'
@@ -48,9 +50,9 @@ jobs:
4850
uses: EndBug/add-and-commit@v5
4951
with:
5052
branch: master
51-
author_name: Github bot
53+
author_name: Github bot
5254
author_email: elmehdi.sakout@gmail.com
53-
message: "Bump manifest version"
55+
message: 'Bump manifest version'
5456

5557
chrome-deploy:
5658
if: ${{ (github.event.inputs.targetStore == 'chrome') || (github.event.inputs.targetStore == 'all') }}
@@ -66,13 +68,13 @@ jobs:
6668
key: ${{ runner.os }}-modules-${{ hashFiles('**/yarn.lock') }}
6769
- name: Install yarn dependencies
6870
run: yarn
69-
71+
7072
- name: Build and zip the extension
7173
run: yarn build-chrome
72-
74+
7375
- name: Install chrome dependencies
7476
run: yarn global add chrome-webstore-upload-cli
75-
77+
7678
- name: Upload the package to Chrome web store
7779
if: ${{ github.event.inputs.testMode == 'false' }}
7880
env:
@@ -96,13 +98,13 @@ jobs:
9698
key: ${{ runner.os }}-modules-${{ hashFiles('**/yarn.lock') }}
9799
- name: Install yarn dependencies
98100
run: yarn
99-
101+
100102
- name: Build and zip the extension
101103
run: yarn build-firefox
102-
104+
103105
- name: Install Firefox dependencies
104106
run: yarn global add web-ext web-ext-submit@6
105-
107+
106108
- name: Upload the package to Firefox web store
107109
if: ${{ github.event.inputs.testMode == 'false' }}
108110
env:

package.json

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,16 +6,13 @@
66
"@amplitude/analytics-browser": "^1.5.5",
77
"@craco/craco": "^6.4.5",
88
"@tanstack/react-query": "^4.13.0",
9-
"@testing-library/jest-dom": "^5.11.4",
10-
"@testing-library/react": "^11.1.0",
11-
"@testing-library/user-event": "^12.1.10",
129
"@types/dompurify": "^2.3.4",
1310
"@types/jspath": "^0.4.0",
1411
"axios": "^0.21.2",
1512
"axios-cache-adapter": "^2.7.3",
1613
"country-emoji": "^1.5.4",
1714
"dompurify": "^2.2.7",
18-
"eslint-plugin-react": "^7.28.0",
15+
"htmlparser2": "^8.0.1",
1916
"jsonpath": "^1.1.1",
2017
"localforage": "^1.9.0",
2118
"normalize.css": "^8.0.1",
@@ -35,11 +32,12 @@
3532
"react-spring-bottom-sheet": "^3.4.1",
3633
"react-toggle": "^4.1.1",
3734
"react-tooltip": "^4.2.21",
35+
"rss-to-json": "^2.1.1",
3836
"styled-components": "2",
3937
"timeago.js": "^4.0.2",
4038
"type-fest": "^1.2.0",
4139
"web-vitals": "^0.2.4",
42-
"zustand": "^4.1.3"
40+
"zustand": "^4.3.3"
4341
},
4442
"proxy": "https://api.hackertab.dev/",
4543
"scripts": {
@@ -72,6 +70,9 @@
7270
"react-error-overlay": "6.0.9"
7371
},
7472
"devDependencies": {
73+
"@testing-library/jest-dom": "^5.11.4",
74+
"@testing-library/react": "^11.1.0",
75+
"@testing-library/user-event": "^12.1.10",
7576
"@types/chrome": "^0.0.198",
7677
"@types/jest": "^29.1.2",
7778
"@types/jsonpath": "^0.2.0",

src/assets/App.css

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -272,7 +272,9 @@ a {
272272
width: 18px;
273273
height: 18px;
274274
}
275-
275+
.blockHeaderIcon .rss {
276+
color:#ee802f;
277+
}
276278
.blockRow {
277279
scroll-snap-align: start;
278280
padding: 8px 16px;

src/assets/variables.css

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,12 @@ html.dark {
8484
--tab-neutral-button-text: #a2a7ad;
8585
--tab-positive-button-background: #0366d6;
8686
--tab-positive-button-text: white;
87+
88+
--settings-input-background-color: #0d1116;
89+
--settings-input-border-color: #3a4553;
90+
--settings-input-border-focus-color: #6b7b90;
91+
--settings-input-placeholder-color: #42474e;
92+
--settings-input-text-color: #fff
8793
}
8894

8995
html.light {
@@ -160,4 +166,11 @@ html.light {
160166
--tab-neutral-button-text: #3c5065;
161167
--tab-positive-button-background: #0366d6;
162168
--tab-positive-button-text: white;
169+
170+
--settings-input-background-color: #ffffff;
171+
--settings-input-border-color: #e9ebec;
172+
--settings-input-border-focus-color: #c4d6df;
173+
--settings-input-placeholder-color: #97a6ad;
174+
--settings-input-text-color: #253b53
175+
163176
}

src/components/Elements/Card/Card.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,11 @@ import React from 'react'
22
import { BsBoxArrowInUpRight } from 'react-icons/bs'
33
import { ref } from 'src/config'
44
import { useUserPreferences } from 'src/stores/preferences'
5-
import { SupportedCard } from 'src/config'
5+
import { SupportedCardType } from 'src/types'
66

77
type CardProps = {
88
children: React.ReactNode
9-
card: SupportedCard
9+
card: SupportedCardType
1010
titleComponent?: React.ReactNode
1111
fullBlock?: boolean
1212
}

src/components/Elements/CardWithActions/CardItemWithActions.tsx

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,23 @@
1-
import React, { useState, useEffect } from 'react'
1+
import React, { useEffect, useState } from 'react'
2+
import { BiBookmarkMinus, BiBookmarkPlus } from 'react-icons/bi'
3+
import { Attributes, trackLinkBookmark, trackLinkUnBookmark } from 'src/lib/analytics'
24
import { useBookmarks } from 'src/stores/bookmarks'
3-
import { BiBookmarkPlus } from 'react-icons/bi'
4-
import { BiBookmarkMinus } from 'react-icons/bi'
5-
import { trackLinkBookmark, trackLinkUnBookmark, Attributes } from 'src/lib/analytics'
65
import { BaseEntry } from 'src/types'
76

87
type CardItemWithActionsProps = {
98
item: BaseEntry
109
index: number
1110
source: string
1211
cardItem: React.ReactNode
12+
sourceType?: 'rss' | 'supported'
1313
}
1414

1515
export const CardItemWithActions = ({
1616
cardItem,
1717
item,
1818
index,
1919
source,
20+
sourceType = 'supported',
2021
}: CardItemWithActionsProps) => {
2122
const { bookmarkPost, unbookmarkPost, userBookmarks } = useBookmarks()
2223
const [isBookmarked, setIsBookmarked] = useState(
@@ -27,6 +28,7 @@ export const CardItemWithActions = ({
2728
title: item.title,
2829
url: item.url,
2930
source,
31+
sourceType: sourceType ?? 'rss',
3032
}
3133
if (isBookmarked) {
3234
unbookmarkPost(itemToBookmark)

src/components/Elements/FloatingFilter/FloatingFilter.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,13 @@ import { FiFilter } from 'react-icons/fi'
33
import { BottomSheet } from 'react-spring-bottom-sheet'
44
import 'react-spring-bottom-sheet/dist/style.css'
55
import { ChipsSet } from 'src/components/Elements'
6-
import { dateRanges, GLOBAL_TAG, MY_LANGUAGES_TAG, SupportedCard } from 'src/config'
6+
import { dateRanges, GLOBAL_TAG, MY_LANGUAGES_TAG } from 'src/config'
77
import { trackCardDateRangeSelect, trackCardLanguageSelect } from 'src/lib/analytics'
88
import { useUserPreferences } from 'src/stores/preferences'
9+
import { SupportedCardType } from 'src/types'
910

1011
type ListingFilterMobileProps = {
11-
card: SupportedCard
12+
card: SupportedCardType
1213
filters?: ('datesRange' | 'language')[]
1314
}
1415

src/components/Layout/AppContentLayout.tsx

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,26 @@
11
import { useState } from 'react'
2-
import { BottomNavigation } from '../Elements'
32
import { isDesktop } from 'react-device-detect'
43
import { useUserPreferences } from 'src/stores/preferences'
5-
import { MobileCards } from './MobileCards'
4+
import { BottomNavigation } from '../Elements'
65
import { DesktopCards } from './DesktopCards'
6+
import { MobileCards } from './MobileCards'
77

88
export const AppContentLayout = ({
99
setShowSettings,
1010
}: {
1111
setShowSettings: (value: boolean | ((prevVar: boolean) => boolean)) => void
1212
}) => {
13-
const { cards } = useUserPreferences()
13+
const { cards, userCustomCards } = useUserPreferences()
1414
const [selectedCard, setSelectedCard] = useState(cards[0])
1515

1616
return (
1717
<>
1818
<main className="AppContent HorizontalScroll">
19-
{isDesktop ? <DesktopCards cards={cards} /> : <MobileCards selectedCard={selectedCard} />}
19+
{isDesktop ? (
20+
<DesktopCards cards={cards} userCustomCards={userCustomCards} />
21+
) : (
22+
<MobileCards selectedCard={selectedCard} />
23+
)}
2024
</main>
2125

2226
<BottomNavigation

src/components/Layout/DesktopCards.tsx

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,25 @@
11
import React from 'react'
22
import { SUPPORTED_CARDS } from 'src/config'
3-
import { SelectedCard } from 'src/types'
3+
import { CustomRssCard } from 'src/features/cards'
4+
import { SelectedCard, SupportedCardType } from 'src/types'
45

5-
export const DesktopCards = ({ cards }: { cards: SelectedCard[] }) => {
6+
export const DesktopCards = ({
7+
cards,
8+
userCustomCards,
9+
}: {
10+
cards: SelectedCard[]
11+
userCustomCards: SupportedCardType[]
12+
}) => {
13+
const AVAILABLE_CARDS = [...SUPPORTED_CARDS, ...userCustomCards]
614
return (
715
<>
816
{cards.map((card, index) => {
9-
const constantCard = SUPPORTED_CARDS.find((c) => c.value === card.name)
17+
const constantCard = AVAILABLE_CARDS.find((c) => c.value === card.name)
1018
if (!constantCard) {
1119
return null
1220
}
1321

14-
return React.createElement(constantCard.component, {
22+
return React.createElement(constantCard?.component || CustomRssCard, {
1523
key: card.name,
1624
meta: constantCard,
1725
withAds: index === 0,

src/components/Layout/Header.tsx

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,15 @@
1-
import React, { useEffect, useRef, useState } from 'react'
2-
import { BsFillGearFill } from 'react-icons/bs'
1+
import { useEffect, useRef, useState } from 'react'
2+
import { BsFillBookmarksFill, BsFillGearFill, BsMoon } from 'react-icons/bs'
33
import { CgTab } from 'react-icons/cg'
4-
import { BsFillBookmarksFill } from 'react-icons/bs'
4+
import { IoMdSunny } from 'react-icons/io'
55
import { ReactComponent as HackertabLogo } from 'src/assets/logo.svg'
6+
import { SearchBar } from 'src/components/Elements/SearchBar'
67
import { UserTags } from 'src/components/Elements/UserTags'
7-
import { SettingsModal } from 'src/features/settings'
8-
import { BsMoon } from 'react-icons/bs'
9-
import { IoMdSunny } from 'react-icons/io'
108
import { Changelog } from 'src/features/changelog'
11-
import { SearchBar } from 'src/components/Elements/SearchBar'
12-
import { useUserPreferences } from 'src/stores/preferences'
9+
import { SettingsModal } from 'src/features/settings'
10+
import { identifyUserTheme, trackThemeSelect } from 'src/lib/analytics'
1311
import { useBookmarks } from 'src/stores/bookmarks'
14-
import { trackThemeSelect, identifyUserTheme } from 'src/lib/analytics'
12+
import { useUserPreferences } from 'src/stores/preferences'
1513

1614
type HeaderProps = {
1715
showSideBar: boolean

0 commit comments

Comments
 (0)