Compare commits
No commits in common. "cff0c2880ad19f5cad78c830e62e1ce72ed6a1cb" and "7205fa5775f40bc0286c5077fc562597519dce0f" have entirely different histories.
cff0c2880a
...
7205fa5775
8 changed files with 117 additions and 50 deletions
|
@ -29,7 +29,7 @@ import { useNavigator } from "../platform/StackedRouter";
|
||||||
const ChooseLang: Component = () => {
|
const ChooseLang: Component = () => {
|
||||||
const { pop } = useNavigator();
|
const { pop } = useNavigator();
|
||||||
const [t] = createTranslator(
|
const [t] = createTranslator(
|
||||||
() => import("./i18n/generic.json"),
|
() => import("./i18n/lang-names.json"),
|
||||||
(code) =>
|
(code) =>
|
||||||
import(`./i18n/${code}.json`) as Promise<{
|
import(`./i18n/${code}.json`) as Promise<{
|
||||||
default: Record<string, string | undefined> & {
|
default: Record<string, string | undefined> & {
|
||||||
|
|
|
@ -27,7 +27,7 @@ import { useNavigator } from "../platform/StackedRouter";
|
||||||
const ChooseRegion: Component = () => {
|
const ChooseRegion: Component = () => {
|
||||||
const {pop} = useNavigator();
|
const {pop} = useNavigator();
|
||||||
const [t] = createTranslator(
|
const [t] = createTranslator(
|
||||||
() => import("./i18n/generic.json"),
|
() => import("./i18n/lang-names.json"),
|
||||||
(code) =>
|
(code) =>
|
||||||
import(`./i18n/${code}.json`) as Promise<{
|
import(`./i18n/${code}.json`) as Promise<{
|
||||||
default: Record<string, string | undefined> & {
|
default: Record<string, string | undefined> & {
|
||||||
|
|
|
@ -161,7 +161,7 @@ const Settings: Component = () => {
|
||||||
import(`./i18n/${code}.json`) as Promise<{
|
import(`./i18n/${code}.json`) as Promise<{
|
||||||
default: Strings;
|
default: Strings;
|
||||||
}>,
|
}>,
|
||||||
() => import(`./i18n/generic.json`),
|
() => import(`./i18n/lang-names.json`),
|
||||||
);
|
);
|
||||||
const { pop } = useNavigator();
|
const { pop } = useNavigator();
|
||||||
const settings$ = useStore($settings);
|
const settings$ = useStore($settings);
|
||||||
|
|
|
@ -325,7 +325,7 @@ const RegularToot: Component<TootCardProps> = (props) => {
|
||||||
source={toot().content}
|
source={toot().content}
|
||||||
emojis={toot().emojis}
|
emojis={toot().emojis}
|
||||||
mentions={toot().mentions}
|
mentions={toot().mentions}
|
||||||
class={cardStyle.cardNoPad}
|
class={tootStyle.tootContent}
|
||||||
/>
|
/>
|
||||||
<Show when={toot().card}>
|
<Show when={toot().card}>
|
||||||
<PreviewCard src={toot().card!} />
|
<PreviewCard src={toot().card!} />
|
||||||
|
|
|
@ -1,29 +0,0 @@
|
||||||
.TootContent {
|
|
||||||
composes: cardNoPad from "../material/cards.module.css";
|
|
||||||
margin-left: calc(var(--card-pad, 0) + var(--toot-avatar-size, 0) + 8px);
|
|
||||||
margin-right: var(--card-pad, 0);
|
|
||||||
line-height: 1.5;
|
|
||||||
|
|
||||||
& * {
|
|
||||||
user-select: text;
|
|
||||||
}
|
|
||||||
|
|
||||||
& a {
|
|
||||||
color: var(--tutu-color-primary-d);
|
|
||||||
}
|
|
||||||
|
|
||||||
& a[target="_blank"] {
|
|
||||||
word-break: break-all;
|
|
||||||
|
|
||||||
>.invisible {
|
|
||||||
display: none;
|
|
||||||
}
|
|
||||||
|
|
||||||
>.ellipsis {
|
|
||||||
&::after {
|
|
||||||
display: inline;
|
|
||||||
content: "...";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -8,7 +8,6 @@ import {
|
||||||
} from "solid-js";
|
} from "solid-js";
|
||||||
import { resolveCustomEmoji } from "../../masto/toot.js";
|
import { resolveCustomEmoji } from "../../masto/toot.js";
|
||||||
import { makeAcctText, useDefaultSession } from "../../masto/clients";
|
import { makeAcctText, useDefaultSession } from "../../masto/clients";
|
||||||
import "./TootContent.css";
|
|
||||||
|
|
||||||
function preventDefault(event: Event) {
|
function preventDefault(event: Event) {
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
|
@ -20,14 +19,9 @@ export type TootContentProps = {
|
||||||
mentions: mastodon.v1.StatusMention[];
|
mentions: mastodon.v1.StatusMention[];
|
||||||
} & JSX.HTMLAttributes<HTMLDivElement>;
|
} & JSX.HTMLAttributes<HTMLDivElement>;
|
||||||
|
|
||||||
const TootContent: Component<TootContentProps> = (oprops) => {
|
const TootContent: Component<TootContentProps> = (props) => {
|
||||||
const session = useDefaultSession();
|
const session = useDefaultSession();
|
||||||
const [props, rest] = splitProps(oprops, [
|
const [managed, rest] = splitProps(props, ["source", "emojis", "mentions"]);
|
||||||
"source",
|
|
||||||
"emojis",
|
|
||||||
"mentions",
|
|
||||||
"class",
|
|
||||||
]);
|
|
||||||
|
|
||||||
const clientFinder = createMemo(() =>
|
const clientFinder = createMemo(() =>
|
||||||
session() ? makeAcctText(session()!) : undefined,
|
session() ? makeAcctText(session()!) : undefined,
|
||||||
|
@ -37,10 +31,10 @@ const TootContent: Component<TootContentProps> = (oprops) => {
|
||||||
<div
|
<div
|
||||||
ref={(ref) => {
|
ref={(ref) => {
|
||||||
createRenderEffect(() => {
|
createRenderEffect(() => {
|
||||||
ref.innerHTML = props.source
|
ref.innerHTML = managed.source
|
||||||
? props.emojis
|
? managed.emojis
|
||||||
? resolveCustomEmoji(props.source, props.emojis)
|
? resolveCustomEmoji(managed.source, managed.emojis)
|
||||||
: props.source
|
: managed.source
|
||||||
: "";
|
: "";
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -59,10 +53,9 @@ const TootContent: Component<TootContentProps> = (oprops) => {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}}
|
}}
|
||||||
class={`TootContent ${props.class || ""}`}
|
|
||||||
{...rest}
|
{...rest}
|
||||||
></div>
|
></div>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
export default TootContent;
|
export default TootContent;
|
|
@ -10,9 +10,9 @@
|
||||||
&.toot {
|
&.toot {
|
||||||
/* fix composition ordering: I think the css module processor should aware the overriding and behaves, but no */
|
/* fix composition ordering: I think the css module processor should aware the overriding and behaves, but no */
|
||||||
transition:
|
transition:
|
||||||
margin-top 60ms var(--tutu-anim-curve-sharp),
|
margin-top 125ms var(--tutu-anim-curve-std),
|
||||||
margin-bottom 60ms var(--tutu-anim-curve-sharp),
|
margin-bottom 125ms var(--tutu-anim-curve-std),
|
||||||
height 60ms var(--tutu-anim-curve-sharp),
|
height 225ms var(--tutu-anim-curve-std),
|
||||||
var(--tutu-transition-shadow);
|
var(--tutu-transition-shadow);
|
||||||
border-radius: 0;
|
border-radius: 0;
|
||||||
}
|
}
|
||||||
|
@ -89,6 +89,103 @@
|
||||||
background-color: var(--tutu-color-surface-d);
|
background-color: var(--tutu-color-surface-d);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.tootContent {
|
||||||
|
composes: cardNoPad from "../material/cards.module.css";
|
||||||
|
margin-left: calc(var(--card-pad, 0) + var(--toot-avatar-size, 0) + 8px);
|
||||||
|
margin-right: var(--card-pad, 0);
|
||||||
|
line-height: 1.5;
|
||||||
|
|
||||||
|
& * {
|
||||||
|
user-select: text;
|
||||||
|
}
|
||||||
|
|
||||||
|
& a {
|
||||||
|
color: var(--tutu-color-primary-d);
|
||||||
|
}
|
||||||
|
|
||||||
|
& :global(a[target="_blank"]) {
|
||||||
|
> :global(.invisible) {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
> :global(.ellipsis) {
|
||||||
|
&::after {
|
||||||
|
display: inline;
|
||||||
|
content: "...";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.previewCard {
|
||||||
|
composes: cardGutSkip from "../material/cards.module.css";
|
||||||
|
display: block;
|
||||||
|
border: 1px solid #eeeeee;
|
||||||
|
background-color: var(--tutu-color-surface);
|
||||||
|
text-decoration: none;
|
||||||
|
border-radius: 4px;
|
||||||
|
overflow: hidden;
|
||||||
|
margin-top: 1em;
|
||||||
|
margin-bottom: 1.5em;
|
||||||
|
color: var(--tutu-color-secondary-text-on-surface);
|
||||||
|
transition: color 220ms var(--tutu-anim-curve-std), background-color 220ms var(--tutu-anim-curve-std);
|
||||||
|
padding-bottom: 8px;
|
||||||
|
overflow: hidden;
|
||||||
|
z-index: 1;
|
||||||
|
position: relative;
|
||||||
|
|
||||||
|
>img {
|
||||||
|
background-color: #eeeeee;
|
||||||
|
max-width: 100%;
|
||||||
|
height: auto;
|
||||||
|
}
|
||||||
|
|
||||||
|
&:hover,
|
||||||
|
&:focus-visible {
|
||||||
|
background-color: var(--tutu-color-surface-d);
|
||||||
|
color: var(--tutu-color-on-surface);
|
||||||
|
|
||||||
|
>h1 {
|
||||||
|
text-decoration: underline;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
>h1 {
|
||||||
|
color: var(--tutu-color-on-surface);
|
||||||
|
max-height: calc(4 * var(--title-line-height) * var(--title-size));
|
||||||
|
}
|
||||||
|
|
||||||
|
>p {
|
||||||
|
max-height: calc(8 * var(--body-line-height) * var(--body-size));
|
||||||
|
}
|
||||||
|
|
||||||
|
>h1,
|
||||||
|
>p {
|
||||||
|
margin-left: 16px;
|
||||||
|
margin-right: 16px;
|
||||||
|
overflow: hidden;
|
||||||
|
text-overflow: ellipsis;
|
||||||
|
}
|
||||||
|
|
||||||
|
&.compact {
|
||||||
|
display: grid;
|
||||||
|
grid-template-columns: minmax(10%, 30%) 1fr;
|
||||||
|
padding-left: 16px;
|
||||||
|
padding-right: 16px;
|
||||||
|
padding-top: 8px;
|
||||||
|
|
||||||
|
>img:first-child {
|
||||||
|
grid-row: 1 / 3;
|
||||||
|
object-fit: contain;
|
||||||
|
}
|
||||||
|
|
||||||
|
>h1,
|
||||||
|
>p {
|
||||||
|
margin-right: 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
.toot.compact {
|
.toot.compact {
|
||||||
display: grid;
|
display: grid;
|
||||||
grid-template-columns: auto 1fr;
|
grid-template-columns: auto 1fr;
|
||||||
|
@ -124,6 +221,12 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.compactTootContent {
|
||||||
|
composes: tootContent;
|
||||||
|
margin-left: 0;
|
||||||
|
margin-right: 0;
|
||||||
|
}
|
||||||
|
|
||||||
.tootRetootGrp {
|
.tootRetootGrp {
|
||||||
display: flex;
|
display: flex;
|
||||||
gap: 0.25em;
|
gap: 0.25em;
|
||||||
|
|
Loading…
Reference in a new issue