<commit_before>/* eslint-disable @typescript-eslint/explicit-function-return-type */
import { AppState } from 'types/store';
import { selectMiniEntities } from 'utilities/store';

function getLocalState(state: AppState) {
  return state.folders;
}

export function getCurrFolderInfo(state: AppState) {
  return getLocalState(state).currFolderInfo;
}

export function getFolderSubfolders(state: AppState) {
  return selectMiniEntities(
    getLocalState(state).subfolders,
    getLocalState(state).subfolders.ids,
  );
}

export function getFolderMaterials(state: AppState) {
  return selectMiniEntities(
    getLocalState(state).materials,
    getLocalState(state).materials.ids,
  );
}

export function getBreadcrumbs(state: AppState) {
  return getLocalState(state).breadcrumbs;
}

export function getAdvanceStartAt(state: AppState) {
  return getLocalState(state).advanceStartAt;
}

export function getFolderPermissions(state: AppState) {
  return getLocalState(state).permissions;
}
<commit_msg>feat(material): sort files and folders alphabetically when first rendered<commit_after>/* eslint-disable @typescript-eslint/explicit-function-return-type */
import { AppState } from 'types/store';
import { selectMiniEntities } from 'utilities/store';

function getLocalState(state: AppState) {
  return state.folders;
}

export function getCurrFolderInfo(state: AppState) {
  return getLocalState(state).currFolderInfo;
}

export function getFolderSubfolders(state: AppState) {
  return selectMiniEntities(
    getLocalState(state).subfolders,
    getLocalState(state).subfolders.ids,
  ).sort((a, b) => (a.name.toUpperCase() > b.name.toUpperCase() ? 1 : -1));
}

export function getFolderMaterials(state: AppState) {
  return selectMiniEntities(
    getLocalState(state).materials,
    getLocalState(state).materials.ids,
  ).sort((a, b) => (a.name.toUpperCase() > b.name.toUpperCase() ? 1 : -1));
}

export function getBreadcrumbs(state: AppState) {
  return getLocalState(state).breadcrumbs;
}

export function getAdvanceStartAt(state: AppState) {
  return getLocalState(state).advanceStartAt;
}

export function getFolderPermissions(state: AppState) {
  return getLocalState(state).permissions;
}

{'fraction_non_alphanumeric': 0.115, 'fraction_numerical': 0.0018181818181818182, 'mean_word_length': 5.943217665615142, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6983479', 'n_tokens_mistral': 697, 'n_tokens_neox': 699, 'n_words': 132}