Skip to content

Commit 58a1a76

Browse files
committed
fix bounds
1 parent bff5aa8 commit 58a1a76

File tree

6 files changed

+73
-33
lines changed

6 files changed

+73
-33
lines changed

src/Compose.tsx

+58-21
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,30 @@
11
import { sendForm } from "./api";
2-
import { borderbox, col, flex, gap, h100, scrolly, w100, wevenly } from "./css";
2+
import { borderbox, col, flex, gap, h100, hcenter, scrolly, w100, wevenly } from "./css";
33
import { Container } from "./Container";
4+
import { KnownStatus } from "./state";
45

5-
let style = css`
6+
const Visibility = {
7+
direct: 0,
8+
private: 1,
9+
local: 2,
10+
unlisted: 3,
11+
public: 4
12+
} as const;
613

14+
let grayed = rule`background-color: blue`;
15+
export const Compose: Component<{
16+
replyto?: KnownStatus
17+
content?: string
18+
// gahd damn liberals
19+
cw?: string
20+
onsend?: () => void
21+
}, {
22+
files: ComponentElement<typeof FileView>[]
23+
inputelm: HTMLElement
24+
sending: boolean
25+
visibility: keyof typeof Visibility
26+
}> = function() {
27+
this.css = css`
728
self {
829
gap: 0.5em;
930
}
@@ -17,20 +38,14 @@ button {
1738
border: none;
1839
background-color: var(--accent);
1940
}
20-
`;
2141
22-
let grayed = rule`background-color: blue`;
23-
export const Compose: Component<{
24-
content?: string
25-
// gahd damn liberals
26-
cw?: string
27-
onsend?: () => void
28-
}, {
29-
files: ComponentElement<typeof FileView>[]
30-
inputelm: HTMLElement
31-
sending: boolean
32-
}> = function() {
33-
this.css = style;
42+
.visibility {
43+
.active {
44+
color: var(--accent);
45+
}
46+
}
47+
`;
48+
this.visibility = this.replyto?.object.visibility || "public";
3449

3550
this.files = [];
3651
this.content ??= "";
@@ -57,21 +72,43 @@ export const Compose: Component<{
5772
</div>
5873
)}
5974

60-
<div class={[flex, w100]}>
61-
<div>
62-
visibility
75+
<div class={[flex, hcenter, w100, gap]}>
76+
<div class={[flex, hcenter, gap, "visibility"]}>
77+
<iconify-icon class={[use(this.visibility, (v: any) => v == "direct" && "active")]} on:click={() => this.visibility = "direct"} icon="fa:envelope" />
78+
{
79+
!this.replyto || Visibility[this.replyto.object.visibility] > Visibility.direct ?
80+
<>
81+
<iconify-icon class={[use(this.visibility, (v: any) => v == "private" && "active")]} on:click={() => this.visibility = "private"} icon="fa:lock" />
82+
{
83+
!this.replyto || Visibility[this.replyto.object.visibility] > Visibility.private ?
84+
<>
85+
<iconify-icon class={[use(this.visibility, (v: any) => v == "unlisted" && "active")]} on:click={() => this.visibility = "unlisted"} icon="fa-solid:lock-open" />
86+
{
87+
!this.replyto || Visibility[this.replyto.object.visibility] > Visibility.unlisted ?
88+
<iconify-icon class={[use(this.visibility, (v: any) => v == "public" && "active")]} on:click={() => this.visibility = "public"} icon="fa:globe" />
89+
: ""
90+
}
91+
</>
92+
: ""
93+
}
94+
</>
95+
: ""
96+
}
6397
</div>
6498
<button class={[grayed]} on:click={async () => {
6599
this.sending = true;
66100
$el.classList.toggle(grayed);
67101
try {
68-
await sendForm("/api/v1/statuses", {
102+
let payload: any = {
69103
status: this.content!,
70104
source: "Pleroma for Nintendo DS",
71-
visibility: "direct",
105+
visibility: this.visibility,
72106
content_type: "text/plain",
73107
language: "en" //rahhhhh
74-
});
108+
};
109+
if (this.replyto)
110+
payload.in_reply_to_id = this.replyto.id;
111+
await sendForm("/api/v1/statuses", payload);
75112
} catch { }
76113
$el.classList.toggle(grayed);
77114
this.sending = false;

src/ContentRenderer.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ self {
1414
}
1515
1616
.embed {
17-
max-width: 400px;
17+
max-width: 300px;
1818
1919
}
2020
`;

src/Notifications.tsx

+2-2
Original file line numberDiff line numberDiff line change
@@ -46,9 +46,9 @@ export const Notifications: Component<{
4646

4747
return (
4848
<Container class={[padding, borderbox, w100, h100]} title="notifications">
49-
<div>
49+
<div class={[w100, borderbox, h100]}>
5050
{$if(use(state.user),
51-
<div class={[flex, col, scrolly, h100, w100, gap, rule`scrollbar-width: none; padding-right: 1em`]}>
51+
<div class={[flex, col, borderbox, scrolly, h100, w100, gap, rule`scrollbar-width: none; padding-right: 1em`]}>
5252
{use(this.notifs)}
5353
</div>,
5454
<div>

src/Post.tsx

+10-7
Original file line numberDiff line numberDiff line change
@@ -61,16 +61,15 @@ self {
6161
transform: scale(130%);
6262
}
6363
64-
65-
img {
66-
border-radius: 5px;
67-
}
68-
6964
.authorshelf {
7065
a {
7166
text-decoration: none;
7267
color: var(--text);
7368
}
69+
70+
img {
71+
border-radius: 5px;
72+
}
7473
}
7574
7675
`;;
@@ -91,9 +90,12 @@ img {
9190
<div class={[flex, gap, "reblogged"]}>
9291
<iconify-icon icon="fa:rocket" />
9392
<AccountView account={reblog.account} />
94-
<div>
93+
<span>
9594
reblogged
96-
</div>
95+
</span>
96+
<span>
97+
{getRelativeTimeString(new Date(post.object.created_at))}
98+
</span>
9799
</div>
98100
) : ""}
99101
{
@@ -189,6 +191,7 @@ img {
189191
<Compose
190192
onsend={() => this.showcompose = false}
191193
content={["@" + post.object.account.acct, ...post.object.mentions.map(acc => "@" + acc.acct)].join(" ")}
194+
replyto={post}
192195
/>
193196
)}
194197
</div>

src/Timeline.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ export const Timeline: Component<{
5353
};
5454

5555
return (
56-
<div class={[flex, col, hcenter, h100, padding, borderbox]}>
56+
<div class={[flex, col, hcenter, h100, padding, borderbox, scrolly]}>
5757
<div bind:this={use(this.postsroot)} class={[w100, flex, col, hcenter, gap, rule`scrollbar-width: none`]}>
5858
{use(this.posts)}
5959
</div>

src/main.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ self {
5858
{$if(use(this.width, w => w < 1200), notifications)}
5959
</div>
6060
)}
61-
<Container title="feed" class={[flex, col, clip, rule`flex: 1`]}>
61+
<Container title="feed" class={[flex, col, rule`flex: 1`]}>
6262
<Navigation />
6363
{use(this.outlet)}
6464
</Container>

0 commit comments

Comments
 (0)