chore: Update translations
Some checks failed
continuous-integration/drone/push Build is failing

This commit is contained in:
Kieran 2023-10-05 13:11:27 +00:00
parent 7c839ae3a8
commit 4d12de302d

View File

@ -29,11 +29,51 @@ export interface TextProps {
const gridConfigMap = new Map<number, number[][]>([ const gridConfigMap = new Map<number, number[][]>([
[1, [[4, 3]]], [1, [[4, 3]]],
[2, [[2, 2], [2, 2]]], [
[3, [[2, 2], [2, 1], [2, 1]]], 2,
[4, [[2, 1], [2, 1], [2, 1], [2, 1]]], [
[5, [[2, 1], [2, 1], [2, 1], [1, 1], [1, 1]]], [2, 2],
[6, [[2, 2], [1, 1], [1, 1], [2, 2], [1, 1], [1, 1]]], [2, 2],
],
],
[
3,
[
[2, 2],
[2, 1],
[2, 1],
],
],
[
4,
[
[2, 1],
[2, 1],
[2, 1],
[2, 1],
],
],
[
5,
[
[2, 1],
[2, 1],
[2, 1],
[1, 1],
[1, 1],
],
],
[
6,
[
[2, 2],
[1, 1],
[1, 1],
[2, 2],
[1, 1],
[1, 1],
],
],
]); ]);
const ROW_HEIGHT = 140; const ROW_HEIGHT = 140;
@ -90,13 +130,7 @@ export default function Text({
} }
const DisableMedia = ({ content }: { content: string }) => ( const DisableMedia = ({ content }: { content: string }) => (
<a <a href={content} onClick={e => e.stopPropagation()} target="_blank" rel="noreferrer" className="ext">
href={content}
onClick={(e) => e.stopPropagation()}
target="_blank"
rel="noreferrer"
className="ext"
>
{content} {content}
</a> </a>
); );
@ -106,12 +140,12 @@ export default function Text({
key={content} key={content}
link={content} link={content}
creator={creator} creator={creator}
onMediaClick={(e) => { onMediaClick={e => {
if (!disableMediaSpotlight) { if (!disableMediaSpotlight) {
e.stopPropagation(); e.stopPropagation();
e.preventDefault(); e.preventDefault();
setShowSpotlight(true); setShowSpotlight(true);
const selected = images.findIndex((b) => b === content); const selected = images.findIndex(b => b === content);
setImageIdx(selected === -1 ? 0 : selected); setImageIdx(selected === -1 ? 0 : selected);
} }
}} }}
@ -147,11 +181,7 @@ export default function Text({
for (let j = i; j < elements.length; j++) { for (let j = i; j < elements.length; j++) {
const nextElement = elements[j + 1]; const nextElement = elements[j + 1];
if ( if (nextElement && nextElement.type === "media" && nextElement.mimeType?.startsWith("image")) {
nextElement &&
nextElement.type === "media" &&
nextElement.mimeType?.startsWith("image")
) {
galleryImages = galleryImages.concat(nextElement); galleryImages = galleryImages.concat(nextElement);
i++; i++;
} else { } else {
@ -165,7 +195,7 @@ export default function Text({
let height = ROW_HEIGHT; let height = ROW_HEIGHT;
if (config && config[index][1] > 1) { if (config && config[index][1] > 1) {
height = (config[index][1] * ROW_HEIGHT) + GRID_GAP; height = config[index][1] * ROW_HEIGHT + GRID_GAP;
} }
return { return {
@ -173,12 +203,11 @@ export default function Text({
gridColumn: config ? config[index][0] : 1, gridColumn: config ? config[index][0] : 1,
gridRow: config ? config[index][1] : 1, gridRow: config ? config[index][1] : 1,
height, height,
} };
}); });
const gallery = ( const gallery = (
<div className="gallery"> <div className="gallery">
{ {imagesWithGridConfig.map(img => (
imagesWithGridConfig.map((img) => (
<div <div
key={img.content} key={img.content}
className="gallery-item" className="gallery-item"
@ -186,19 +215,20 @@ export default function Text({
height: `${img.height}px`, height: `${img.height}px`,
gridColumn: `span ${img.gridColumn}`, gridColumn: `span ${img.gridColumn}`,
gridRow: `span ${img.gridRow}`, gridRow: `span ${img.gridRow}`,
}} }}>
>
<RevealMediaInstance content={img.content} /> <RevealMediaInstance content={img.content} />
</div> </div>
)) ))}
}
</div> </div>
); );
chunks = chunks.concat(gallery); chunks = chunks.concat(gallery);
} }
} }
if (element.type === "media" && (element.mimeType?.startsWith("audio") || element.mimeType?.startsWith("video"))) { if (
element.type === "media" &&
(element.mimeType?.startsWith("audio") || element.mimeType?.startsWith("video"))
) {
if (disableMedia ?? false) { if (disableMedia ?? false) {
chunks = chunks.concat(<DisableMedia content={element.content} />); chunks = chunks.concat(<DisableMedia content={element.content} />);
} else { } else {
@ -214,8 +244,10 @@ export default function Text({
if (element.type === "cashu") { if (element.type === "cashu") {
chunks = chunks.concat(<CashuNuts token={element.content} />); chunks = chunks.concat(<CashuNuts token={element.content} />);
} }
if(element.type === "link" || (element.type === 'media' && element.mimeType?.startsWith('unknown'))) { if (element.type === "link" || (element.type === "media" && element.mimeType?.startsWith("unknown"))) {
chunks = chunks.concat(<HyperText link={element.content} depth={depth} showLinkPreview={!(disableLinkPreview ?? false)} />); chunks = chunks.concat(
<HyperText link={element.content} depth={depth} showLinkPreview={!(disableLinkPreview ?? false)} />,
);
} }
if (element.type === "custom_emoji") { if (element.type === "custom_emoji") {
chunks = chunks.concat(<ProxyImg src={element.content} size={15} className="custom-emoji" />); chunks = chunks.concat(<ProxyImg src={element.content} size={15} className="custom-emoji" />);
@ -223,12 +255,9 @@ export default function Text({
if (element.type === "text") { if (element.type === "text") {
chunks = chunks.concat( chunks = chunks.concat(
<div className="text-frag"> <div className="text-frag">
{highlighText {highlighText ? renderContentWithHighlightedText(element.content, highlighText) : element.content}
? renderContentWithHighlightedText(element.content, highlighText)
: element.content}
</div>, </div>,
); );
} }
} }
return chunks; return chunks;