Small fixes

This commit is contained in:
DrMint 2023-02-22 06:19:29 +01:00
parent 0420dc30a4
commit 88a67e4e85
10 changed files with 39 additions and 38 deletions

View File

@ -1,9 +1,10 @@
import { useCallback, useEffect, useMemo, useRef, useState } from "react";
import { useRouter } from "next/router";
import { atom } from "jotai";
import { cJoin, cIf } from "helpers/className";
import { isDefined, isDefinedAndNotEmpty } from "helpers/asserts";
import { atoms } from "contexts/atoms";
import { useAtomSetter, useAtomPair } from "helpers/atoms";
import { useAtomSetter, useAtomPair, atomPairing } from "helpers/atoms";
/*
*
@ -12,6 +13,9 @@ import { useAtomSetter, useAtomPair } from "helpers/atoms";
const LINE_PREFIX = "root@accords-library.com:";
const previousLinesAtom = atomPairing(atom<string[]>([]));
const previousCommandsAtom = atomPairing(atom<string[]>([]));
/*
*
* COMPONENT
@ -33,8 +37,8 @@ export const Terminal = ({
const [childrenPaths, setChildrenPaths] = useState(propsChildrenPaths);
const setPlayerName = useAtomSetter(atoms.settings.playerName);
const [previousCommands, setPreviousCommands] = useAtomPair(atoms.terminal.previousCommands);
const [previousLines, setPreviousLines] = useAtomPair(atoms.terminal.previousLines);
const [previousCommands, setPreviousCommands] = useAtomPair(previousCommandsAtom);
const [previousLines, setPreviousLines] = useAtomPair(previousLinesAtom);
const [line, setLine] = useState("");
const [displayCurrentLine, setDisplayCurrentLine] = useState(true);
@ -112,7 +116,6 @@ export const Terminal = ({
key: "rm",
description: "Remove files or directories",
handle: (currentLine, parameters) => {
console.log(parameters);
if (parameters.startsWith("-r ")) {
const folder = parameters.slice("-r ".length);
if (childrenPaths.includes(folder)) {

View File

@ -17,6 +17,11 @@ import { Ico } from "components/Ico";
import { useFormat } from "hooks/useFormat";
import { ToolTip } from "components/ToolTip";
/*
*
* COMPONENT
*/
export const SettingsPopup = (): JSX.Element => {
const [preferredLanguages, setPreferredLanguages] = useAtomPair(
atoms.settings.preferredLanguages
@ -142,7 +147,7 @@ export const SettingsPopup = (): JSX.Element => {
const newCurrencyName = currencyOptions[newCurrency];
if (isDefined(newCurrencyName)) {
setCurrency(newCurrencyName);
sendAnalytics("Settings", `Change currency (${currencyOptions[newCurrency]})}`);
sendAnalytics("Settings", `Change currency (${currencyOptions[newCurrency]})`);
}
}}
className="w-28"

View File

@ -1,7 +1,6 @@
import { Fragment, useCallback } from "react";
import { AppLayout, AppLayoutRequired } from "./AppLayout";
import { Chip } from "./Chip";
import { HorizontalLine } from "./HorizontalLine";
import { getTocFromMarkdawn, Markdawn, TableOfContents } from "./Markdown/Markdawn";
import { ReturnButton } from "./PanelComponents/ReturnButton";
import { ContentPanel } from "./Containers/ContentPanel";
@ -132,20 +131,17 @@ export const PostPage = ({
)}
{displayThumbnailHeader ? (
<>
<ThumbnailHeader
thumbnail={thumbnail}
title={title}
description={excerpt}
categories={post.categories}
languageSwitcher={
languageSwitcherProps.locales.size > 1 ? (
<LanguageSwitcher {...languageSwitcherProps} />
) : undefined
}
/>
{(isDefined(prependBody) || isDefined(body)) && <HorizontalLine />}
</>
<ThumbnailHeader
thumbnail={thumbnail}
title={title}
description={excerpt}
categories={post.categories}
languageSwitcher={
languageSwitcherProps.locales.size > 1 ? (
<LanguageSwitcher {...languageSwitcherProps} />
) : undefined
}
/>
) : (
<>
{displayLanguageSwitcher && (

View File

@ -174,14 +174,14 @@ export const PreviewCard = ({
)}
<div
className={cJoin(
"z-20 gap-2 p-4 transition-opacity linearbg-obi",
"z-20 grid gap-2 p-4 transition-opacity linearbg-obi",
cIf(
!keepInfoVisible && isHoverable,
`-inset-x-0.5 bottom-2 opacity-0 shadow-shade
[border-radius:10%_10%_10%_10%_/_1%_1%_3%_3%]
group-hover:opacity-100 hoverable:absolute hoverable:drop-shadow-lg
notHoverable:rounded-b-md notHoverable:opacity-100`,
"grid [border-radius:0%_0%_10%_10%_/_0%_0%_3%_3%]"
"[border-radius:0%_0%_10%_10%_/_0%_0%_3%_3%]"
)
)}>
{metadata?.position === "Top" && metadataJSX}

View File

@ -53,20 +53,9 @@ const layout = {
terminalMode,
};
/* [ TERMINAL ATOMS ] */
const previousLines = atomPairing(atom<string[]>([]));
const previousCommands = atomPairing(atom<string[]>([]));
const terminal = {
previousLines,
previousCommands,
};
export const atoms = {
settings,
layout,
terminal,
localData,
lightBox,
containerQueries,

View File

@ -191,7 +191,9 @@ const Channel = ({ channel, ...otherProps }: Props): JSX.Element => {
setSortingMethod(newSort);
sendAnalytics(
"Videos",
`Change sorting method (${sortingMethods.map((item) => item.displayedName)[newSort]})`
`Change sorting method (${
sortingMethods.map((item) => item.meiliAttribute)[newSort]
})`
);
}}
/>

View File

@ -183,7 +183,9 @@ const Videos = ({ ...otherProps }: Props): JSX.Element => {
setSortingMethod(newSort);
sendAnalytics(
"Videos",
`Change sorting method (${sortingMethods.map((item) => item.displayedName)[newSort]})`
`Change sorting method (${
sortingMethods.map((item) => item.meiliAttribute)[newSort]
})`
);
}}
/>

View File

@ -173,7 +173,9 @@ const Contents = (props: Props): JSX.Element => {
setSortingMethod(newSort);
sendAnalytics(
"Contents/All",
`Change sorting method (${sortingMethods.map((item) => item.displayedName)[newSort]})`
`Change sorting method (${
sortingMethods.map((item) => item.meiliAttribute)[newSort]
})`
);
}}
/>

View File

@ -88,7 +88,7 @@ const LibrarySlug = ({ item, itemId, ...otherProps }: Props): JSX.Element => {
const setSubPanelOpened = useAtomSetter(atoms.layout.subPanelOpened);
const closeSubPanel = useCallback(() => setSubPanelOpened(false), [setSubPanelOpened]);
useScrollTopOnChange(Ids.ContentPanel, [item]);
useScrollTopOnChange(Ids.ContentPanel, [itemId]);
const currentIntersection = useIntersectionList(intersectionIds);
const isVariantSet =

View File

@ -279,7 +279,9 @@ const Library = (props: Props): JSX.Element => {
setSortingMethod(newSort);
sendAnalytics(
"Library",
`Change sorting method (${sortingMethods.map((item) => item.displayedName)[newSort]})`
`Change sorting method (${
sortingMethods.map((item) => item.meiliAttribute)[newSort]
})`
);
}}
/>