Skip to content

Commit 15869e3

Browse files
committed
Always show original video notice
1 parent b79646f commit 15869e3

File tree

2 files changed

+19
-5
lines changed

2 files changed

+19
-5
lines changed

src/entries/contentScript/components/Card.jsx

Lines changed: 18 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,9 @@ function Card({
3535
color,
3636
className,
3737
compact = false,
38+
forceOpen = false,
3839
}) {
39-
const [isExpanded, setIsExpanded] = useState(false);
40+
const [isExpanded, setIsExpanded] = useState(forceOpen);
4041

4142
function getExpandedCards() {
4243
if (!localStorage) {
@@ -53,6 +54,10 @@ function Card({
5354
}
5455

5556
function toggleExpanded() {
57+
if (forceOpen) {
58+
return;
59+
}
60+
5661
setIsExpanded(!isExpanded);
5762

5863
if (!localStorage) {
@@ -73,12 +78,16 @@ function Card({
7378
}
7479

7580
useEffect(() => {
81+
if (!forceOpen) {
82+
return;
83+
}
84+
7685
const expandedCards = getExpandedCards();
7786

7887
setIsExpanded(
7988
expandedCards.filter((cardId) => cardId === id).length > 0,
8089
);
81-
}, [id]);
90+
}, [id, forceOpen]);
8291

8392
const colorClassName = {
8493
default: 'border border-gray-200 dark:border-gray-600',
@@ -118,9 +127,12 @@ function Card({
118127
{preview}
119128
</div>
120129
)}
121-
<div>
122-
<ChevronDownIcon className={classNames(isExpanded && 'rotate-180', 'size-6 transition-transform opacity-70')} />
123-
</div>
130+
131+
{!forceOpen && (
132+
<div>
133+
<ChevronDownIcon className={classNames(isExpanded && 'rotate-180', 'size-6 transition-transform opacity-70')} />
134+
</div>
135+
)}
124136
</div>
125137
</button>
126138

@@ -171,6 +183,7 @@ Card.propTypes = {
171183
titleCompact: PropTypes.string,
172184
preview: PropTypes.string,
173185
compact: PropTypes.bool,
186+
forceOpen: PropTypes.bool,
174187
};
175188

176189
Card.defaultProps = {

src/entries/contentScript/components/OriginalVideoNotice.jsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,7 @@ function OriginalVideoNotice() {
7272
title={originalVideoReactions.length > 1 ? t('originalVideo.titlePlural') : t('originalVideo.title')}
7373
color="primary"
7474
compact={compact}
75+
forceOpen
7576
>
7677
<div className="mt-3 flex flex-col gap-4">
7778
{originalVideoReactions.map((reaction) => (

0 commit comments

Comments
 (0)