Skip to content

Commit 4dcb047

Browse files
authored
Morer visual fixes (#1443)
<!-- Please read https://github.com/SableClient/Sable/blob/dev/CONTRIBUTING.md before submitting your pull request --> ### Description <!-- Please include a summary of the change. Please also include relevant motivation and context. List any dependencies that are required for this change. --> Forgot to fix the style for tweaks aswel Removed the linkify for replies because replies shouldnt redirect you to another site Tweaks: (old) <img width="431" height="768" alt="image" src="https://github.com/user-attachments/assets/05a3b9ed-3bdc-4bbb-9c98-244825a2acff" /> (new) <img width="433" height="771" alt="image" src="https://github.com/user-attachments/assets/5bc64336-348d-41f5-b5f9-47db2dc637da" /> You can imagine the links Fixes # #### Type of change - [x] Bug fix (non-breaking change which fixes an issue) - [ ] New feature (non-breaking change which adds functionality) - [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected) - [ ] This change requires a documentation update ### Checklist: - [ ] My code follows the style guidelines of this project - [ ] I have performed a self-review of my own code - [ ] I have commented my code, particularly in hard-to-understand areas - [ ] I have made corresponding changes to the documentation - [ ] My changes generate no new warnings ### AI disclosure: - [ ] Partially AI assisted (clarify which code was AI assisted and briefly explain what it does). - [ ] Fully AI generated (explain what all the generated code does in moderate detail). <!-- Write any explanation required here, but do not generate the explanation using AI!! You must prove you understand what the code in this PR does. --> Written w the assistance of using my skewb as a stim toy
2 parents fc6d055 + 68de59f commit 4dcb047

3 files changed

Lines changed: 58 additions & 80 deletions

File tree

src/app/components/message/Reply.tsx

Lines changed: 2 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -32,14 +32,7 @@ import { getReactionKey, getReactionShortcode, getRedactionTargetId } from '$uti
3232
import { getMxIdLocalPart } from '$utils/matrix';
3333
import { randomNumberBetween } from '$utils/common';
3434
import { sanitizeCustomHtml } from '$utils/sanitize';
35-
import {
36-
getReactCustomHtmlParser,
37-
scaleSystemEmoji,
38-
LINKIFY_OPTS,
39-
makeMentionCustomProps,
40-
factoryRenderLinkifyWithMention,
41-
renderMatrixMention,
42-
} from '$plugins/react-custom-html-parser';
35+
import { getReactCustomHtmlParser, scaleSystemEmoji } from '$plugins/react-custom-html-parser';
4336
import { useRoomEvent } from '$hooks/useRoomEvent';
4437
import { useSableCosmetics } from '$hooks/useSableCosmetics';
4538
import { useMediaAuthentication } from '$hooks/useMediaAuthentication';
@@ -332,24 +325,6 @@ export const Reply = as<'div', ReplyProps>(
332325
let image: ReactNode | undefined;
333326
let mentioned = sender != null && (mentions?.user_ids?.includes(sender) ?? false);
334327

335-
const replyLinkifyOpts = useMemo(
336-
() => ({
337-
...LINKIFY_OPTS,
338-
render: factoryRenderLinkifyWithMention(
339-
settingsLinkBaseUrl,
340-
(href) =>
341-
renderMatrixMention(
342-
mx,
343-
room.roomId,
344-
href,
345-
makeMentionCustomProps(mentionClickHandler),
346-
nicknames
347-
),
348-
mentionClickHandler
349-
),
350-
}),
351-
[mx, room.roomId, mentionClickHandler, nicknames, settingsLinkBaseUrl]
352-
);
353328
if (eventType === M_POLL_START.name) {
354329
const question = (
355330
replyEvent?.getContent()[M_POLL_START.name] as {
@@ -364,7 +339,7 @@ export const Reply = as<'div', ReplyProps>(
364339
if (shouldParseReplyFormattedPreview(sanitizedHtml)) {
365340
const parserOpts = getReactCustomHtmlParser(mx, room.roomId, {
366341
settingsLinkBaseUrl,
367-
linkifyOpts: replyLinkifyOpts,
342+
linkifyOpts: undefined,
368343
useAuthentication,
369344
nicknames,
370345
handleMentionClick: mentionClickHandler,

src/app/features/settings/cosmetics/ThemeCatalogSettings.tsx

Lines changed: 54 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,60 @@ function CatalogTweakCard({
152152
>
153153
<Box direction="Row" alignItems="Start" justifyContent="SpaceBetween" gap="200">
154154
<Box direction="Column" gap="100" grow="Yes" style={{ minWidth: 0 }}>
155-
<Text size="H6">{displayName}</Text>
155+
<Box direction="Row" justifyContent="SpaceBetween" alignContent="Center">
156+
<Text size="H6">{displayName}</Text>
157+
<Box direction="Row" gap="100" alignItems="Center" shrink="No">
158+
<CssViewerButton
159+
title={`${displayName} — CSS`}
160+
cssText={cssText}
161+
ariaLabel="View tweak CSS"
162+
/>
163+
{copyUrl && (
164+
<IconButton
165+
size="300"
166+
variant="Secondary"
167+
fill="Soft"
168+
outlined
169+
radii="300"
170+
aria-label={copied ? 'Copied tweak link' : 'Copy tweak link'}
171+
onClick={() => {
172+
handleCopy().catch(() => undefined);
173+
}}
174+
>
175+
{menuIcon(copied ? Check : Link)}
176+
</IconButton>
177+
)}
178+
{onExport && (
179+
<IconButton
180+
size="300"
181+
variant="Secondary"
182+
fill="Soft"
183+
outlined
184+
radii="300"
185+
aria-label="Export tweak CSS"
186+
onClick={() => {
187+
onExport();
188+
}}
189+
>
190+
{menuIcon(Download)}
191+
</IconButton>
192+
)}
193+
<IconButton
194+
size="300"
195+
variant={isFavorited ? 'Primary' : 'Secondary'}
196+
fill="Soft"
197+
outlined
198+
radii="300"
199+
aria-label={isFavorited ? 'Remove tweak from saved' : 'Save tweak'}
200+
onClick={() => {
201+
Promise.resolve(onToggleFavorite()).catch(() => undefined);
202+
}}
203+
>
204+
{menuIcon(Star, { weight: isFavorited ? 'fill' : 'regular' })}
205+
</IconButton>
206+
<Switch variant="Primary" value={isOn} onChange={onSetApplied} />
207+
</Box>
208+
</Box>
156209
<Text size="T200" priority="300" style={{ wordBreak: 'break-word' }}>
157210
{description}
158211
</Text>
@@ -166,57 +219,6 @@ function CatalogTweakCard({
166219
<Text size="B300">Third-party URL</Text>
167220
</Chip>
168221
)}
169-
<Box direction="Row" gap="100" alignItems="Center">
170-
<CssViewerButton
171-
title={`${displayName} — CSS`}
172-
cssText={cssText}
173-
ariaLabel="View tweak CSS"
174-
/>
175-
{copyUrl && (
176-
<IconButton
177-
size="300"
178-
variant="Secondary"
179-
fill="Soft"
180-
outlined
181-
radii="300"
182-
aria-label={copied ? 'Copied tweak link' : 'Copy tweak link'}
183-
onClick={() => {
184-
handleCopy().catch(() => undefined);
185-
}}
186-
>
187-
{menuIcon(copied ? Check : Link)}
188-
</IconButton>
189-
)}
190-
{onExport && (
191-
<IconButton
192-
size="300"
193-
variant="Secondary"
194-
fill="Soft"
195-
outlined
196-
radii="300"
197-
aria-label="Export tweak CSS"
198-
onClick={() => {
199-
onExport();
200-
}}
201-
>
202-
{menuIcon(Download)}
203-
</IconButton>
204-
)}
205-
<IconButton
206-
size="300"
207-
variant={isFavorited ? 'Primary' : 'Secondary'}
208-
fill="Soft"
209-
outlined
210-
radii="300"
211-
aria-label={isFavorited ? 'Remove tweak from saved' : 'Save tweak'}
212-
onClick={() => {
213-
Promise.resolve(onToggleFavorite()).catch(() => undefined);
214-
}}
215-
>
216-
{menuIcon(Star, { weight: isFavorited ? 'fill' : 'regular' })}
217-
</IconButton>
218-
<Switch variant="Primary" value={isOn} onChange={onSetApplied} />
219-
</Box>
220222
</Box>
221223
</Box>
222224
</Box>

src/app/plugins/react-custom-html-parser.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -585,7 +585,7 @@ export const getReactCustomHtmlParser = (
585585
roomId: string | undefined,
586586
params: {
587587
settingsLinkBaseUrl: string;
588-
linkifyOpts: LinkifyOpts;
588+
linkifyOpts?: LinkifyOpts;
589589
highlightRegex?: RegExp;
590590
handleSpoilerClick?: ReactEventHandler<HTMLElement>;
591591
handleMentionClick?: ReactEventHandler<HTMLElement>;
@@ -828,6 +828,7 @@ export const getReactCustomHtmlParser = (
828828
}
829829
}
830830

831+
if (!params.linkifyOpts) return <span {...anchorProps}>{renderChildren()}</span>;
831832
return <a {...anchorProps}>{renderedChildren}</a>;
832833
}
833834

0 commit comments

Comments
 (0)