Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
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
1 change: 1 addition & 0 deletions src/app/components/image-pack-view/ImageTile.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ export function ImageTile({
variant={deleted ? 'Critical' : 'Secondary'}
fill="None"
radii="Pill"
aria-label={deleted ? 'Undo deletion' : 'Mark for deletion'}
onClick={() => onDeleteToggle?.(defaultShortcode)}
>
{deleted ? <Text size="B300">Undo</Text> : <Icon size="50" src={Icons.Delete} />}
Expand Down
6 changes: 3 additions & 3 deletions src/app/components/message/content/ImageContent.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -144,15 +144,15 @@ export const ImageContent = as<'div', ImageContentProps>(
useEffect(() => {
if (!viewer) {
setViewerFullSrc(null);
return;
return undefined;
}
if (
typeof matrixThumbnailMaxEdge !== 'number' ||
matrixThumbnailMaxEdge <= 0 ||
encInfo ||
url.startsWith('http')
) {
return;
return undefined;
}
let cancelled = false;
void (async () => {
Expand Down Expand Up @@ -200,7 +200,7 @@ export const ImageContent = as<'div', ImageContentProps>(
: isContained
? { minHeight: containedReserveStrip ? toRem(stripMin) : undefined }
: hasDimensions
? { aspectRatio: `${info!.w} / ${info!.h}` }
? { aspectRatio: `${info.w} / ${info.h}` }
: { minHeight: '150px' };

const fillPreviewSlotStyle = fillsSlot
Expand Down
3 changes: 2 additions & 1 deletion src/app/features/room/RoomCallButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@ export function RoomCallButton({ room }: RoomCallButtonProps) {
startCall(room, { microphone, video, sound });
try {
const now = Date.now();
// TODO not use as any one day someday i swear
// org.matrix.msc4075.rtc.notification is not yet in the SDK's TimelineEvents union;
// cast to keyof TimelineEvents to satisfy sendEvent's overload until MSC4075 lands.
await mx.sendEvent(
room.roomId,
'org.matrix.msc4075.rtc.notification' as keyof TimelineEvents,
Expand Down
4 changes: 2 additions & 2 deletions src/app/features/room/ThreadDrawer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -317,7 +317,7 @@ export function ThreadDrawer({ room, threadRootId, onClose, overlay }: ThreadDra
if (room.getThread(threadRootId)) return; // created concurrently
room.createThread(threadRootId, new MatrixEvent(rawEvt as IEvent), [], false);
})
.catch(() => {});
.catch(console.warn);
}
}

Expand Down Expand Up @@ -359,7 +359,7 @@ export function ThreadDrawer({ room, threadRootId, onClose, overlay }: ThreadDra

mx.paginateEventTimeline(currThread.timelineSet.getLiveTimeline(), { backwards: true })
.then(() => forceUpdate((n) => n + 1))
.catch(() => {});
.catch(console.warn);
// forceUpdateCounter must be in deps so this effect re-runs after
// ThreadEvent.Update fires (which flips initialEventsFetched from false to
// true).
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,6 @@ export function PerMessageProfileEditor({
const [currentId, setCurrentId] = useState(profileId);
const [newId, setNewId] = useState(profileId);

console.warn(pronouns);

// Pronouns
const [currentPronouns, setCurrentPronouns] = useState(pronouns);
const [newPronouns, setNewPronouns] = useState(pronouns);
Expand Down
4 changes: 2 additions & 2 deletions src/app/features/settings/developer-tools/AccountData.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,14 @@ type AccountDataProps = {
export function AccountData({ expand, onExpandToggle, onSelect }: AccountDataProps) {
const mx = useMatrixClient();
const [accountDataTypes, setAccountDataKeys] = useState<string[]>(() =>
// TODO: tighten this once account data event typing is standardized.
// Account data keys are arbitrary strings (any MSC or custom event); no further narrowing needed.
Array.from(mx.store.accountData.keys())
);

useAccountDataCallback(
mx,
useCallback(() => {
// TODO: tighten this once account data event typing is standardized.
// Account data keys are arbitrary strings (any MSC or custom event); no further narrowing needed.
setAccountDataKeys(Array.from(mx.store.accountData.keys()));
}, [mx])
);
Expand Down
4 changes: 2 additions & 2 deletions src/app/features/settings/developer-tools/DevelopTools.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ export function DeveloperTools({ requestBack, requestClose }: DeveloperToolsProp

const submitAccountData: AccountDataSubmitCallback = useCallback(
async (type, content) => {
// TODO: remove cast once account data typing is unified.
// as never: developer tools submit arbitrary account data types beyond the typed enum.
await mx.setAccountData(type as never, content as never);
},
[mx]
Expand All @@ -40,7 +40,7 @@ export function DeveloperTools({ requestBack, requestClose }: DeveloperToolsProp
type={accountDataType ?? undefined}
content={
accountDataType
? // TODO: remove cast once account data typing is unified.
? // as never: developer tools read arbitrary account data types beyond the typed enum.
mx.getAccountData(accountDataType as never)?.getContent()
: undefined
}
Expand Down
96 changes: 0 additions & 96 deletions src/app/utils/ASCIILexicalTable.ts
Original file line number Diff line number Diff line change
Expand Up @@ -239,102 +239,6 @@ export class ASCIILexicalTable {
}
}

// const printLex = (lex: ASCIILexicalTable) => {
// const padRight = (s: string, maxWidth: number, padding: string): string => {
// let ns = s;
// for (let i = s.length; i < maxWidth; i += 1) {
// ns += padding;
// }
// return ns;
// };

// const formattedLine = (n: number, item: string): string =>
// `|${padRight(n.toString(), lex.size().toString().length, ' ')}|${item}|`;

// const hr = `|${padRight('-', lex.size().toString().length, '-')}|${padRight(
// '-',
// lex.maxStrWidth,
// '-'
// )}|`;

// console.log(`All lexicographic string combination in order.`);
// console.log(`Start ASCII code: "${lex.startCode}"`);
// console.log(`End ASCII code: "${lex.endCode}"`);
// console.log(`Max string width: ${lex.maxStrWidth}`);
// console.log(`Total String Combination Count: ${lex.size()}\n`);
// console.log('Table:');
// console.log(hr);
// for (let i = 0; i < lex.size(); i += 1) {
// const str = lex.get(i);
// if (str) {
// console.log(formattedLine(i, padRight(str, lex.maxStrWidth, '_')));
// }
// }
// console.log(hr);
// };

// console.log('\n');

// const lex = new ASCIILexicalTable('a'.charCodeAt(0), 'c'.charCodeAt(0), 3);
// printLex(lex);
// console.log(lex.size());
// console.log(lex.nBetween(8, ' ', '~~~~~'));
// console.log(lex.between('a', 'ccc'));
// console.log(lex.get(11));
// console.log(lex.get(11) === 'aaac');

// const lex4 = new ASCIILexicalTable(' '.charCodeAt(0), '~'.charCodeAt(0), 5);
// console.log('Size: ', lex4.size());
// console.log('Between: ', lex4.between('7g7g5', 'caccc'));
// printLex(lex4);

// console.log('\n');

// const perf = () => {
// const loopLength = 99999;
// const lexT = new ASCIILexicalTable('a'.charCodeAt(0), 'z'.charCodeAt(0), 9);
// console.log(lexT.size());
// const str = 'bcbba';
// const strI = lexT.index(str);
// console.log('================');
// console.time('index');
// console.log(lexT.index(str));
// for (let i = 0; i < loopLength; i += 1) {
// lexT.index(str);
// }
// console.timeEnd('index');
// console.log('================');
// console.time('get');
// console.log(lexT.get(strI));
// for (let i = 0; i < loopLength; i += 1) {
// lexT.get(strI);
// }
// console.timeEnd('get');
// console.log('================');
// console.time('previous');
// console.log(lexT.previous(str));
// for (let i = 0; i < loopLength; i += 1) {
// lexT.previous(str);
// }
// console.timeEnd('previous');
// console.log('================');
// console.time('next');
// console.log(lexT.next(str));
// for (let i = 0; i < loopLength; i += 1) {
// lexT.next(str);
// }
// console.timeEnd('next');
// console.log('================');
// console.time('between');
// console.log(lexT.between(str, 'cbbca'));
// for (let i = 0; i < loopLength; i += 1) {
// lexT.between(str, 'cbbca');
// }
// console.timeEnd('between');
// };

// perf();

const findNextFilledKey = (
fromIndex: number,
keys: Array<string | undefined>
Expand Down
Loading