Small fixes
This commit is contained in:
parent
0420dc30a4
commit
88a67e4e85
|
@ -1,9 +1,10 @@
|
||||||
import { useCallback, useEffect, useMemo, useRef, useState } from "react";
|
import { useCallback, useEffect, useMemo, useRef, useState } from "react";
|
||||||
import { useRouter } from "next/router";
|
import { useRouter } from "next/router";
|
||||||
|
import { atom } from "jotai";
|
||||||
import { cJoin, cIf } from "helpers/className";
|
import { cJoin, cIf } from "helpers/className";
|
||||||
import { isDefined, isDefinedAndNotEmpty } from "helpers/asserts";
|
import { isDefined, isDefinedAndNotEmpty } from "helpers/asserts";
|
||||||
import { atoms } from "contexts/atoms";
|
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 LINE_PREFIX = "root@accords-library.com:";
|
||||||
|
|
||||||
|
const previousLinesAtom = atomPairing(atom<string[]>([]));
|
||||||
|
const previousCommandsAtom = atomPairing(atom<string[]>([]));
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* ╭─────────────╮
|
* ╭─────────────╮
|
||||||
* ───────────────────────────────────────╯ COMPONENT ╰───────────────────────────────────────────
|
* ───────────────────────────────────────╯ COMPONENT ╰───────────────────────────────────────────
|
||||||
|
@ -33,8 +37,8 @@ export const Terminal = ({
|
||||||
const [childrenPaths, setChildrenPaths] = useState(propsChildrenPaths);
|
const [childrenPaths, setChildrenPaths] = useState(propsChildrenPaths);
|
||||||
const setPlayerName = useAtomSetter(atoms.settings.playerName);
|
const setPlayerName = useAtomSetter(atoms.settings.playerName);
|
||||||
|
|
||||||
const [previousCommands, setPreviousCommands] = useAtomPair(atoms.terminal.previousCommands);
|
const [previousCommands, setPreviousCommands] = useAtomPair(previousCommandsAtom);
|
||||||
const [previousLines, setPreviousLines] = useAtomPair(atoms.terminal.previousLines);
|
const [previousLines, setPreviousLines] = useAtomPair(previousLinesAtom);
|
||||||
|
|
||||||
const [line, setLine] = useState("");
|
const [line, setLine] = useState("");
|
||||||
const [displayCurrentLine, setDisplayCurrentLine] = useState(true);
|
const [displayCurrentLine, setDisplayCurrentLine] = useState(true);
|
||||||
|
@ -112,7 +116,6 @@ export const Terminal = ({
|
||||||
key: "rm",
|
key: "rm",
|
||||||
description: "Remove files or directories",
|
description: "Remove files or directories",
|
||||||
handle: (currentLine, parameters) => {
|
handle: (currentLine, parameters) => {
|
||||||
console.log(parameters);
|
|
||||||
if (parameters.startsWith("-r ")) {
|
if (parameters.startsWith("-r ")) {
|
||||||
const folder = parameters.slice("-r ".length);
|
const folder = parameters.slice("-r ".length);
|
||||||
if (childrenPaths.includes(folder)) {
|
if (childrenPaths.includes(folder)) {
|
||||||
|
|
|
@ -17,6 +17,11 @@ import { Ico } from "components/Ico";
|
||||||
import { useFormat } from "hooks/useFormat";
|
import { useFormat } from "hooks/useFormat";
|
||||||
import { ToolTip } from "components/ToolTip";
|
import { ToolTip } from "components/ToolTip";
|
||||||
|
|
||||||
|
/*
|
||||||
|
* ╭─────────────╮
|
||||||
|
* ───────────────────────────────────────╯ COMPONENT ╰───────────────────────────────────────────
|
||||||
|
*/
|
||||||
|
|
||||||
export const SettingsPopup = (): JSX.Element => {
|
export const SettingsPopup = (): JSX.Element => {
|
||||||
const [preferredLanguages, setPreferredLanguages] = useAtomPair(
|
const [preferredLanguages, setPreferredLanguages] = useAtomPair(
|
||||||
atoms.settings.preferredLanguages
|
atoms.settings.preferredLanguages
|
||||||
|
@ -142,7 +147,7 @@ export const SettingsPopup = (): JSX.Element => {
|
||||||
const newCurrencyName = currencyOptions[newCurrency];
|
const newCurrencyName = currencyOptions[newCurrency];
|
||||||
if (isDefined(newCurrencyName)) {
|
if (isDefined(newCurrencyName)) {
|
||||||
setCurrency(newCurrencyName);
|
setCurrency(newCurrencyName);
|
||||||
sendAnalytics("Settings", `Change currency (${currencyOptions[newCurrency]})}`);
|
sendAnalytics("Settings", `Change currency (${currencyOptions[newCurrency]})`);
|
||||||
}
|
}
|
||||||
}}
|
}}
|
||||||
className="w-28"
|
className="w-28"
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
import { Fragment, useCallback } from "react";
|
import { Fragment, useCallback } from "react";
|
||||||
import { AppLayout, AppLayoutRequired } from "./AppLayout";
|
import { AppLayout, AppLayoutRequired } from "./AppLayout";
|
||||||
import { Chip } from "./Chip";
|
import { Chip } from "./Chip";
|
||||||
import { HorizontalLine } from "./HorizontalLine";
|
|
||||||
import { getTocFromMarkdawn, Markdawn, TableOfContents } from "./Markdown/Markdawn";
|
import { getTocFromMarkdawn, Markdawn, TableOfContents } from "./Markdown/Markdawn";
|
||||||
import { ReturnButton } from "./PanelComponents/ReturnButton";
|
import { ReturnButton } from "./PanelComponents/ReturnButton";
|
||||||
import { ContentPanel } from "./Containers/ContentPanel";
|
import { ContentPanel } from "./Containers/ContentPanel";
|
||||||
|
@ -132,20 +131,17 @@ export const PostPage = ({
|
||||||
)}
|
)}
|
||||||
|
|
||||||
{displayThumbnailHeader ? (
|
{displayThumbnailHeader ? (
|
||||||
<>
|
<ThumbnailHeader
|
||||||
<ThumbnailHeader
|
thumbnail={thumbnail}
|
||||||
thumbnail={thumbnail}
|
title={title}
|
||||||
title={title}
|
description={excerpt}
|
||||||
description={excerpt}
|
categories={post.categories}
|
||||||
categories={post.categories}
|
languageSwitcher={
|
||||||
languageSwitcher={
|
languageSwitcherProps.locales.size > 1 ? (
|
||||||
languageSwitcherProps.locales.size > 1 ? (
|
<LanguageSwitcher {...languageSwitcherProps} />
|
||||||
<LanguageSwitcher {...languageSwitcherProps} />
|
) : undefined
|
||||||
) : undefined
|
}
|
||||||
}
|
/>
|
||||||
/>
|
|
||||||
{(isDefined(prependBody) || isDefined(body)) && <HorizontalLine />}
|
|
||||||
</>
|
|
||||||
) : (
|
) : (
|
||||||
<>
|
<>
|
||||||
{displayLanguageSwitcher && (
|
{displayLanguageSwitcher && (
|
||||||
|
|
|
@ -174,14 +174,14 @@ export const PreviewCard = ({
|
||||||
)}
|
)}
|
||||||
<div
|
<div
|
||||||
className={cJoin(
|
className={cJoin(
|
||||||
"z-20 gap-2 p-4 transition-opacity linearbg-obi",
|
"z-20 grid gap-2 p-4 transition-opacity linearbg-obi",
|
||||||
cIf(
|
cIf(
|
||||||
!keepInfoVisible && isHoverable,
|
!keepInfoVisible && isHoverable,
|
||||||
`-inset-x-0.5 bottom-2 opacity-0 shadow-shade
|
`-inset-x-0.5 bottom-2 opacity-0 shadow-shade
|
||||||
[border-radius:10%_10%_10%_10%_/_1%_1%_3%_3%]
|
[border-radius:10%_10%_10%_10%_/_1%_1%_3%_3%]
|
||||||
group-hover:opacity-100 hoverable:absolute hoverable:drop-shadow-lg
|
group-hover:opacity-100 hoverable:absolute hoverable:drop-shadow-lg
|
||||||
notHoverable:rounded-b-md notHoverable:opacity-100`,
|
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}
|
{metadata?.position === "Top" && metadataJSX}
|
||||||
|
|
|
@ -53,20 +53,9 @@ const layout = {
|
||||||
terminalMode,
|
terminalMode,
|
||||||
};
|
};
|
||||||
|
|
||||||
/* [ TERMINAL ATOMS ] */
|
|
||||||
|
|
||||||
const previousLines = atomPairing(atom<string[]>([]));
|
|
||||||
const previousCommands = atomPairing(atom<string[]>([]));
|
|
||||||
|
|
||||||
const terminal = {
|
|
||||||
previousLines,
|
|
||||||
previousCommands,
|
|
||||||
};
|
|
||||||
|
|
||||||
export const atoms = {
|
export const atoms = {
|
||||||
settings,
|
settings,
|
||||||
layout,
|
layout,
|
||||||
terminal,
|
|
||||||
localData,
|
localData,
|
||||||
lightBox,
|
lightBox,
|
||||||
containerQueries,
|
containerQueries,
|
||||||
|
|
|
@ -191,7 +191,9 @@ const Channel = ({ channel, ...otherProps }: Props): JSX.Element => {
|
||||||
setSortingMethod(newSort);
|
setSortingMethod(newSort);
|
||||||
sendAnalytics(
|
sendAnalytics(
|
||||||
"Videos",
|
"Videos",
|
||||||
`Change sorting method (${sortingMethods.map((item) => item.displayedName)[newSort]})`
|
`Change sorting method (${
|
||||||
|
sortingMethods.map((item) => item.meiliAttribute)[newSort]
|
||||||
|
})`
|
||||||
);
|
);
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
|
|
|
@ -183,7 +183,9 @@ const Videos = ({ ...otherProps }: Props): JSX.Element => {
|
||||||
setSortingMethod(newSort);
|
setSortingMethod(newSort);
|
||||||
sendAnalytics(
|
sendAnalytics(
|
||||||
"Videos",
|
"Videos",
|
||||||
`Change sorting method (${sortingMethods.map((item) => item.displayedName)[newSort]})`
|
`Change sorting method (${
|
||||||
|
sortingMethods.map((item) => item.meiliAttribute)[newSort]
|
||||||
|
})`
|
||||||
);
|
);
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
|
|
|
@ -173,7 +173,9 @@ const Contents = (props: Props): JSX.Element => {
|
||||||
setSortingMethod(newSort);
|
setSortingMethod(newSort);
|
||||||
sendAnalytics(
|
sendAnalytics(
|
||||||
"Contents/All",
|
"Contents/All",
|
||||||
`Change sorting method (${sortingMethods.map((item) => item.displayedName)[newSort]})`
|
`Change sorting method (${
|
||||||
|
sortingMethods.map((item) => item.meiliAttribute)[newSort]
|
||||||
|
})`
|
||||||
);
|
);
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
|
|
|
@ -88,7 +88,7 @@ const LibrarySlug = ({ item, itemId, ...otherProps }: Props): JSX.Element => {
|
||||||
const setSubPanelOpened = useAtomSetter(atoms.layout.subPanelOpened);
|
const setSubPanelOpened = useAtomSetter(atoms.layout.subPanelOpened);
|
||||||
const closeSubPanel = useCallback(() => setSubPanelOpened(false), [setSubPanelOpened]);
|
const closeSubPanel = useCallback(() => setSubPanelOpened(false), [setSubPanelOpened]);
|
||||||
|
|
||||||
useScrollTopOnChange(Ids.ContentPanel, [item]);
|
useScrollTopOnChange(Ids.ContentPanel, [itemId]);
|
||||||
const currentIntersection = useIntersectionList(intersectionIds);
|
const currentIntersection = useIntersectionList(intersectionIds);
|
||||||
|
|
||||||
const isVariantSet =
|
const isVariantSet =
|
||||||
|
|
|
@ -279,7 +279,9 @@ const Library = (props: Props): JSX.Element => {
|
||||||
setSortingMethod(newSort);
|
setSortingMethod(newSort);
|
||||||
sendAnalytics(
|
sendAnalytics(
|
||||||
"Library",
|
"Library",
|
||||||
`Change sorting method (${sortingMethods.map((item) => item.displayedName)[newSort]})`
|
`Change sorting method (${
|
||||||
|
sortingMethods.map((item) => item.meiliAttribute)[newSort]
|
||||||
|
})`
|
||||||
);
|
);
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
|
|
Loading…
Reference in New Issue