Skip to content

Commit 92fea23

Browse files
committed
chore(utils/ui): jsdocs
Signed-off-by: Adam Setch <adam.setch@outlook.com>
1 parent 7b6039e commit 92fea23

4 files changed

Lines changed: 30 additions & 9 deletions

File tree

src/renderer/utils/ui/cn.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,12 @@
11
import { type ClassValue, clsx } from 'clsx';
22
import { twMerge } from 'tailwind-merge';
33

4+
/**
5+
* Merges class names using clsx and resolves Tailwind CSS conflicts with tailwind-merge.
6+
*
7+
* @param inputs - One or more class values (strings, arrays, objects, etc.).
8+
* @returns A single merged class name string with Tailwind conflicts resolved.
9+
*/
410
export function cn(...inputs: ClassValue[]) {
511
return twMerge(clsx(...inputs));
612
}

src/renderer/utils/ui/display.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,14 @@ export interface ParsedCodePart {
1212
content: string;
1313
}
1414

15+
/**
16+
* Returns the appropriate chevron icon and accessible label for a collapsible section.
17+
*
18+
* @param hasNotifications - Whether the section has any notifications to display.
19+
* @param isVisible - Whether the section is currently expanded/visible.
20+
* @param type - The type of section (`'account'` or `'repository'`).
21+
* @returns A `Chevron` object containing the icon component and its accessible label.
22+
*/
1523
export function getChevronDetails(
1624
hasNotifications: boolean,
1725
isVisible: boolean,

src/renderer/utils/ui/emojis.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,13 @@ import twemoji, { type TwemojiOptions } from '@discordapp/twemoji';
22

33
const EMOJI_FORMAT = 'svg';
44

5+
/**
6+
* Parses a text string and replaces Unicode emoji characters with local SVG `<img>` tags.
7+
* The SVG file paths are resolved from the Electron main process.
8+
*
9+
* @param text - The text string potentially containing emoji characters.
10+
* @returns Promise resolving to an HTML string with emojis replaced by `<img>` elements.
11+
*/
512
export async function convertTextToEmojiImgHtml(text: string): Promise<string> {
613
const directory = await window.gitify.twemojiDirectory();
714

src/renderer/utils/ui/zoom.ts

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -40,29 +40,29 @@ export function zoomLevelToPercentage(zoom: number): Percentage {
4040
}
4141

4242
/**
43-
* Returns true if can decrease zoom percentage further.
43+
* Returns `true` if the zoom can be decreased by one step.
4444
*
4545
* @param zoomPercentage - The current zoom percentage.
46-
* @returns `true` if decrementing by one step stays at or above the minimum.
46+
* @returns `true` if decreasing by one step would remain at or above the minimum, `false` otherwise.
4747
*/
4848
export function canDecreaseZoom(zoomPercentage: Percentage) {
4949
return zoomPercentage - ZOOM_STEP >= MINIMUM_ZOOM_PERCENTAGE;
5050
}
5151

5252
/**
53-
* Returns true if can increase zoom percentage further.
53+
* Returns `true` if the zoom can be increased by one step.
5454
*
5555
* @param zoomPercentage - The current zoom percentage.
56-
* @returns `true` if incrementing by one step stays at or below the maximum.
56+
* @returns `true` if increasing by one step would remain at or below the maximum, `false` otherwise.
5757
*/
5858
export function canIncreaseZoom(zoomPercentage: Percentage) {
5959
return zoomPercentage + ZOOM_STEP <= MAXIMUM_ZOOM_PERCENTAGE;
6060
}
6161

6262
/**
63-
* Decrease zoom by one step amount, if possible.
63+
* Decreases the zoom level by one step if possible, then applies it via the Electron zoom bridge.
6464
*
65-
* @param zoomPercentage - The current zoom percentage.
65+
* @param zoomPercentage - Current zoom percentage.
6666
*/
6767
export function decreaseZoom(zoomPercentage: Percentage) {
6868
if (canDecreaseZoom(zoomPercentage)) {
@@ -73,9 +73,9 @@ export function decreaseZoom(zoomPercentage: Percentage) {
7373
}
7474

7575
/**
76-
* Increase zoom by one step amount, if possible.
76+
* Increases the zoom level by one step if possible, then applies it via the Electron zoom bridge.
7777
*
78-
* @param zoomPercentage - The current zoom percentage.
78+
* @param zoomPercentage - Current zoom percentage.
7979
*/
8080
export function increaseZoom(zoomPercentage: Percentage) {
8181
if (canIncreaseZoom(zoomPercentage)) {
@@ -86,7 +86,7 @@ export function increaseZoom(zoomPercentage: Percentage) {
8686
}
8787

8888
/**
89-
* Reset zoom level
89+
* Resets the zoom level to the recommended default, then applies it via the Electron zoom bridge.
9090
*/
9191
export function resetZoomLevel() {
9292
window.gitify.zoom.setLevel(

0 commit comments

Comments
 (0)