-
-
-
+
+
+
+
+
>
);
diff --git a/src/timelines/RegularToot.tsx b/src/timelines/RegularToot.tsx
index 84c1c38..63ef7c1 100644
--- a/src/timelines/RegularToot.tsx
+++ b/src/timelines/RegularToot.tsx
@@ -4,6 +4,7 @@ import {
type Component,
type JSX,
Show,
+ createRenderEffect,
createSignal,
type Setter,
createContext,
diff --git a/src/timelines/TootList.tsx b/src/timelines/TootList.tsx
index 35986a5..b35dcce 100644
--- a/src/timelines/TootList.tsx
+++ b/src/timelines/TootList.tsx
@@ -7,7 +7,6 @@ import {
Index,
createMemo,
For,
- createUniqueId,
} from "solid-js";
import { type mastodon } from "masto";
import { vibrate } from "~platform/hardware";
@@ -22,7 +21,6 @@ import cardStyle from "~material/cards.module.css";
import type { ThreadNode } from "../masto/timelines";
import { useNavigator } from "~platform/StackedRouter";
import { ANIM_CURVE_STD } from "~material/theme";
-import { useItemSelection } from "./toots/ItemSelectionProvider";
function durationOf(rect0: DOMRect, rect1: DOMRect) {
const distancelt = Math.sqrt(
@@ -47,9 +45,6 @@ function positionTootInThread(index: number, threadLength: number) {
return "middle";
}
-/**
- * Full-feature toot list.
- */
const TootList: Component<{
ref?: Ref
;
id?: string;
@@ -58,7 +53,7 @@ const TootList: Component<{
onChangeToot: (id: string, value: mastodon.v1.Status) => void;
}> = (props) => {
const session = useDefaultSession();
- const [isExpanded, setExpanded] = useItemSelection();
+ const [expandedThreadId, setExpandedThreadId] = createSignal();
const { push } = useNavigator();
const onBookmark = async (status: mastodon.v1.Status) => {
@@ -195,7 +190,7 @@ const TootList: Component<{
event.currentTarget,
);
- if (actionableElement && isExpanded(event.currentTarget.id)) {
+ if (actionableElement && checkIsExpended(status)) {
if (actionableElement.dataset.action === "acct") {
event.stopPropagation();
@@ -219,13 +214,18 @@ const TootList: Component<{
}
// else if (!actionableElement || !checkIsExpended(status) || )
- if (!isExpanded(event.currentTarget.id)) {
- setExpanded(event.currentTarget.id);
+ if (status.id !== expandedThreadId()) {
+ setExpandedThreadId((x) => (x ? undefined : status.id));
} else {
openFullScreenToot(status, event.currentTarget as HTMLElement);
}
};
+ const checkIsExpendedId = createSelector(expandedThreadId);
+
+ const checkIsExpended = (status: mastodon.v1.Status) =>
+ checkIsExpendedId(status.id);
+
const reply = (
status: mastodon.v1.Status,
event: { currentTarget: HTMLElement },
@@ -234,7 +234,10 @@ const TootList: Component<{
openFullScreenToot(status, element, true);
};
- const vote = async (status: mastodon.v1.Status, votes: readonly number[]) => {
+ const vote = async (
+ status: mastodon.v1.Status,
+ votes: readonly number[]
+ ) => {
const client = session()?.client;
if (!client) return;
@@ -268,15 +271,13 @@ const TootList: Component<{
return Oops: {String(err)}
;
}}
>
-
+
{(threadId, threadIdx) => {
@@ -290,13 +291,11 @@ const TootList: Component<{
{(threadNode, index) => {
const status = () => threadNode().value;
- const id = createUniqueId();
return (
1
@@ -304,8 +303,8 @@ const TootList: Component<{
: undefined
}
class={cardStyle.card}
- evaluated={isExpanded(id)}
- actionable={isExpanded(id)}
+ evaluated={checkIsExpended(status())}
+ actionable={checkIsExpended(status())}
onClick={[onItemClick, status()]}
/>
);
diff --git a/src/timelines/toots/ItemSelectionProvider.ts b/src/timelines/toots/ItemSelectionProvider.ts
deleted file mode 100644
index e19e024..0000000
--- a/src/timelines/toots/ItemSelectionProvider.ts
+++ /dev/null
@@ -1,35 +0,0 @@
-import {
- createContext,
- createSelector,
- createSignal,
- useContext,
- type Accessor,
-} from "solid-js";
-
-export type ItemSelectionState = [(value: T) => boolean, (value: T) => void];
-
-const ItemSelectionContext = /* @__PURE__ */ createContext<
- ItemSelectionState
->([() => false, () => undefined]);
-
-export function createSingluarItemSelection(
- intial?: T,
-): readonly [Accessor, ItemSelectionState] {
- const [value, setValue] = createSignal(intial);
-
- const select = createSelector(value, (a, b) =>
- typeof b !== "undefined" ? a === b : false,
- );
-
- const toggle = (v: T | undefined) => {
- setValue((o) => (o ? undefined : v));
- };
-
- return [value, [select, toggle]];
-}
-
-export function useItemSelection() {
- return useContext(ItemSelectionContext);
-}
-
-export default ItemSelectionContext.Provider;
diff --git a/src/timelines/toots/TootAuthorGroup.css b/src/timelines/toots/TootAuthorGroup.css
index e52794f..1d62d16 100644
--- a/src/timelines/toots/TootAuthorGroup.css
+++ b/src/timelines/toots/TootAuthorGroup.css
@@ -10,7 +10,7 @@
}
}
-.TootAuthorGroup>.name-grp {
+.TootAuthorGroup > .name-grp {
display: grid;
grid-template-columns: 1fr auto;
color: var(--tutu-color-secondary-text-on-surface);
@@ -22,16 +22,18 @@
>time {
text-align: end;
}
+
+ &:hover {
+ > .name-primary {
+ text-decoration: underline;
+ }
+ }
}
-.RegularToot.expanded .TootAuthorGroup>.name-grp>.name-primary {
- text-decoration: underline;
-}
-
-.TootAuthorGroup>.name-grp>.name-primary {
+.TootAuthorGroup > .name-grp > .name-primary {
color: var(--tutu-color-on-surface);
- >.acct-mark {
+ > .acct-mark {
font-size: 1.2em;
color: var(--tutu-color-secondary-text-on-surface);
vertical-align: sub;
@@ -39,7 +41,7 @@
}
}
-.TootAuthorGroup>.avatar {
+.TootAuthorGroup > .avatar {
width: calc(var(--toot-avatar-size, 40px) - 1px);
aspect-ratio: 1/1;
object-fit: contain;