Skip to content

Chat · Modules

9 modules · 32 exports · 1 repository · 16 e2e tests · 5 routes

Who imports who · hover a node
Depends onChat modulesUsed byAttention2 exportsCooldowns6 exportsLogLayout2 exportsMentionAlerts1 exportMentions9 exportsMessageLinks1 exportReplies3 exportsSounds2 exportsStickers6 exportsOther6 filesComponents6 files

Attention

app/features/chat/core/Attention.ts

No overview comment at the top of the file.

Imports
no other modules
Used by
1 module3 other

Types

type

Tracker

no JSDoc:26
export type Tracker = ReturnType<typeof createTracker>;

Functions & values

const

tracker

no JSDoc:128
export const tracker = createTracker(() => ({
	document,
	window,
	lastActiveTab: {
		read: () => PersistedState.read(lastActiveTabPersisted),
		write: (tabId) => PersistedState.write(lastActiveTabPersisted, tabId),
	},
	now: () => Date.now(),
}));
Unit tests not about one export (6)

Not shown, only used by tests: createTracker

Cooldowns

app/features/chat/core/Cooldowns.ts

No overview comment at the top of the file.

Imports
no other modules
Used by
1 component

Functions & values

const

MENTION_COOLDOWN_MS

no JSDoc:4
export const MENTION_COOLDOWN_MS = 5_000;
const

STICKER_COOLDOWN_MS

no JSDoc:5
export const STICKER_COOLDOWN_MS = 15_000;
const

STICKER_COOLDOWN_KEY

no JSDoc:6
export const STICKER_COOLDOWN_KEY = "sticker";
function

mentionKey

no JSDoc:8
export function mentionKey(userId: number)
function

start

no JSDoc:12
export function start(keys: string[], durationMs: number, now = Date.now())

LogLayout

app/features/chat/core/LogLayout.ts

No overview comment at the top of the file.

Imports
Replies
Used by
2 components

Functions & values

function

continuesBatch

no JSDoc:6
export function continuesBatch(
	previous: ClientChatMessage | undefined,
	message: ClientChatMessage,
)
Unit tests (1)
function

firstUnreadMessageId

no JSDoc:22
export function firstUnreadMessageId({
	messages,
	divider,
	ownUserId,
}: {
	messages: ClientChatMessage[];
	divider: UnreadDivider | undefined;
	ownUserId: number;
}): number | null
Unit tests (1)

MentionAlerts

app/features/chat/core/MentionAlerts.ts

No overview comment at the top of the file.

Imports
no other modules
Used by
1 other

Functions & values

function

create

no JSDoc:3
export function create({
	attention,
	playSound,
	resolveMentions,
}: {
	attention: Pick<
		Attention.Tracker,
		"isAttending" | "isLastActiveTab" | "subscribe"
	>;
	playSound: () => void;
	resolveMentions: (roomId: number) => void;
})
Unit tests (4)

Mentions

app/features/chat/core/Mentions.ts

No overview comment at the top of the file.

Imports
no other modules
Used by
2 components3 other

Types

interface

PickedMention

no JSDoc:12
export interface PickedMention {
	userId: number;
	username: string;
	start: number;
}

Functions & values

function

split

no JSDoc:22
export function split(contents: string): MessagePart[]
Unit tests (2)
function

mentionedUserIds

no JSDoc:44
export function mentionedUserIds(contents: string)
function

mentionsUser

no JSDoc:52
export function mentionsUser(contents: string, userId: number)
Unit tests (1)
function

visibleLength

no JSDoc:56
export function visibleLength(contents: string)
Unit tests (1)
function

encode

no JSDoc:60
export function encode(
	text: string,
	users: Array<{ id: number; username: string }>,
	pickedMentions: PickedMention[] = [],
)
Unit tests (2)
function

shiftPicked

no JSDoc:92
export function shiftPicked(
	pickedMentions: PickedMention[],
	previousText: string,
	nextText: string,
): PickedMention[]
Unit tests (1)
function

activeQuery

no JSDoc:124
export function activeQuery(text: string, caret: number)
Unit tests (1)
function

suggestions

no JSDoc:131
export function suggestions<T extends { username: string }>(
	users: T[],
	query: string,
)
Unit tests (2)

Not shown, only used by tests: token

app/features/chat/core/MessageLinks.ts

No overview comment at the top of the file.

Imports
no other modules
Used by
1 component

Functions & values

functionno JSDoc:20
export function findRoomLinks(
	text: string,
): Array<{ url: string; index: number }>
Unit tests (5)
Unit tests not about one export (2)

Not shown, only used by tests: isSplatnetRoomUrl

Replies

app/features/chat/core/Replies.ts

No overview comment at the top of the file.

Imports
no other modules
Used by
1 module2 components1 other

Functions & values

function

token

no JSDoc:3
export function token(messageId: number)
function

split

no JSDoc:7
export function split(contents: string)
Unit tests (1)
function

hasValid

no JSDoc:16
export function hasValid(contents: string)
Unit tests (1)

Sounds

app/features/chat/core/Sounds.ts

No overview comment at the top of the file.

Imports
no other modules
Used by
1 component3 other

Functions & values

function

playIgnoringSetting

:17

Plays regardless of the user's setting (e.g. volume preview); cuts off any sound already playing.

export function playIgnoringSetting(soundCode: string)

Stickers

app/features/chat/core/Stickers.ts

No overview comment at the top of the file.

Imports
no other modules
Used by
3 components1 other

Types

type

ChatSticker

no JSDoc:25
export type ChatSticker = (typeof CHAT_STICKERS)[number];

Functions & values

function

token

no JSDoc:30
export function token(stickerId: string)
function

split

no JSDoc:34
export function split(contents: string)
Unit tests (1)
function

hasValid

no JSDoc:41
export function hasValid(contents: string)
Unit tests (1)
function

activeQuery

no JSDoc:46
export function activeQuery(text: string, caret: number)
Unit tests (1)
function

suggestions

no JSDoc:53
export function suggestions(query: string)
Unit tests (1)

Not shown, only used by tests: CHAT_STICKERS