tangled
alpha
login
or
join now
leaflet.pub
/
leaflet
289
fork
atom
a tool for shared writing and social publishing
289
fork
atom
overview
issues
28
pulls
pipelines
add post options wip to the pub settings menu
cozylittle.house
2 months ago
fe614d2a
2bf60b64
+64
-19
5 changed files
expand all
collapse all
unified
split
app
lish
[did]
[publication]
dashboard
Actions.tsx
settings
PostOptions.tsx
PublicationSettings.tsx
createPub
UpdatePubForm.tsx
components
ThemeManager
PubThemeSetter.tsx
+1
-1
app/lish/[did]/[publication]/dashboard/Actions.tsx
···
1
1
"use client";
2
2
3
3
import { NewDraftActionButton } from "./NewDraftButton";
4
4
-
import { PublicationSettingsButton } from "./PublicationSettings";
4
4
+
import { PublicationSettingsButton } from "./settings/PublicationSettings";
5
5
import { ActionButton } from "components/ActionBar/ActionButton";
6
6
import { ShareSmall } from "components/Icons/ShareSmall";
7
7
import { Menu } from "components/Layout";
+28
-14
app/lish/[did]/[publication]/dashboard/PublicationSettings.tsx
app/lish/[did]/[publication]/dashboard/settings/PublicationSettings.tsx
···
12
12
import { ButtonPrimary } from "components/Buttons";
13
13
import { DotLoader } from "components/utils/DotLoader";
14
14
import { ArrowRightTiny } from "components/Icons/ArrowRightTiny";
15
15
+
import { PostOptions } from "./PostOptions";
16
16
+
17
17
+
type menuState = "menu" | "general" | "theme" | "post-options";
15
18
16
19
export function PublicationSettingsButton(props: { publication: string }) {
17
20
let isMobile = useIsMobile();
18
18
-
let [state, setState] = useState<"menu" | "general" | "theme">("menu");
21
21
+
let [state, setState] = useState<menuState>("menu");
19
22
let [loading, setLoading] = useState(false);
20
23
21
24
return (
···
42
45
/>
43
46
) : state === "theme" ? (
44
47
<PubThemeSetter
48
48
+
backToMenu={() => setState("menu")}
49
49
+
loading={loading}
50
50
+
setLoading={setLoading}
51
51
+
/>
52
52
+
) : state === "post-options" ? (
53
53
+
<PostOptions
45
54
backToMenu={() => setState("menu")}
46
55
loading={loading}
47
56
setLoading={setLoading}
···
59
68
}
60
69
61
70
const PubSettingsMenu = (props: {
62
62
-
state: "menu" | "general" | "theme";
63
63
-
setState: (s: typeof props.state) => void;
71
71
+
state: menuState;
72
72
+
setState: (s: menuState) => void;
64
73
loading: boolean;
65
74
setLoading: (l: boolean) => void;
66
75
}) => {
···
73
82
loading={props.loading}
74
83
setLoadingAction={props.setLoading}
75
84
state={"menu"}
76
76
-
/>
85
85
+
>
86
86
+
Settings
87
87
+
</PubSettingsHeader>
77
88
<button
78
89
className={menuItemClassName}
79
90
type="button"
···
81
92
props.setState("general");
82
93
}}
83
94
>
84
84
-
Publication Settings
95
95
+
General Settings
85
96
<ArrowRightTiny />
86
97
</button>
87
98
<button
···
89
100
type="button"
90
101
onClick={() => props.setState("theme")}
91
102
>
92
92
-
Publication Theme
103
103
+
Theme
104
104
+
<ArrowRightTiny />
105
105
+
</button>
106
106
+
<button
107
107
+
className={menuItemClassName}
108
108
+
type="button"
109
109
+
onClick={() => props.setState("post-options")}
110
110
+
>
111
111
+
Post Layout
93
112
<ArrowRightTiny />
94
113
</button>
95
114
</div>
···
97
116
};
98
117
99
118
export const PubSettingsHeader = (props: {
100
100
-
state: "menu" | "general" | "theme";
119
119
+
state: menuState;
101
120
backToMenuAction?: () => void;
102
121
loading: boolean;
103
122
setLoadingAction: (l: boolean) => void;
123
123
+
children: React.ReactNode;
104
124
}) => {
105
125
return (
106
126
<div className="flex justify-between font-bold text-secondary bg-border-light -mx-3 -mt-2 px-3 py-2 mb-1">
107
107
-
{props.state === "menu"
108
108
-
? "Settings"
109
109
-
: props.state === "general"
110
110
-
? "General"
111
111
-
: props.state === "theme"
112
112
-
? "Publication Theme"
113
113
-
: ""}
127
127
+
{props.children}
114
128
{props.state !== "menu" && (
115
129
<div className="flex gap-2">
116
130
<button
+27
app/lish/[did]/[publication]/dashboard/settings/PostOptions.tsx
···
1
1
+
import { PubSettingsHeader } from "./PublicationSettings";
2
2
+
3
3
+
export const PostOptions = (props: {
4
4
+
backToMenu: () => void;
5
5
+
loading: boolean;
6
6
+
setLoading: (l: boolean) => void;
7
7
+
}) => {
8
8
+
return (
9
9
+
<div className="text-primary flex flex-col">
10
10
+
<PubSettingsHeader
11
11
+
loading={props.loading}
12
12
+
setLoadingAction={props.setLoading}
13
13
+
backToMenuAction={props.backToMenu}
14
14
+
state={"post-options"}
15
15
+
>
16
16
+
Post Options
17
17
+
</PubSettingsHeader>
18
18
+
<h4>Layout</h4>
19
19
+
<div>Post Width</div>
20
20
+
<div>Show Prev Next Buttons</div>
21
21
+
<hr />
22
22
+
<h4>Interactions</h4>
23
23
+
<div>Show Comments</div>
24
24
+
<div>Show Mentions</div>
25
25
+
</div>
26
26
+
);
27
27
+
};
+4
-2
app/lish/createPub/UpdatePubForm.tsx
···
20
20
import Link from "next/link";
21
21
import { Checkbox } from "components/Checkbox";
22
22
import type { GetDomainConfigResponseBody } from "@vercel/sdk/esm/models/getdomainconfigop";
23
23
-
import { PubSettingsHeader } from "../[did]/[publication]/dashboard/PublicationSettings";
23
23
+
import { PubSettingsHeader } from "../[did]/[publication]/dashboard/settings/PublicationSettings";
24
24
25
25
export const EditPubForm = (props: {
26
26
backToMenuAction: () => void;
···
86
86
setLoadingAction={props.setLoadingAction}
87
87
backToMenuAction={props.backToMenuAction}
88
88
state={"theme"}
89
89
-
/>
89
89
+
>
90
90
+
General Settings
91
91
+
</PubSettingsHeader>
90
92
<div className="flex flex-col gap-3 w-[1000px] max-w-full pb-2">
91
93
<div className="flex items-center justify-between gap-2 ">
92
94
<p className="pl-0.5 pb-0.5 text-tertiary italic text-sm font-bold">
+4
-2
components/ThemeManager/PubThemeSetter.tsx
···
15
15
import { BackgroundPicker } from "./PubPickers/PubBackgroundPickers";
16
16
import { PubAccentPickers } from "./PubPickers/PubAcccentPickers";
17
17
import { Separator } from "components/Layout";
18
18
-
import { PubSettingsHeader } from "app/lish/[did]/[publication]/dashboard/PublicationSettings";
18
18
+
import { PubSettingsHeader } from "app/lish/[did]/[publication]/dashboard/settings/PublicationSettings";
19
19
import { ColorToRGB, ColorToRGBA } from "./colorToLexicons";
20
20
import { useToaster } from "components/Toast";
21
21
import { OAuthErrorMessage, isOAuthSessionError } from "components/OAuthError";
···
116
116
setLoadingAction={props.setLoading}
117
117
backToMenuAction={props.backToMenu}
118
118
state={"theme"}
119
119
-
/>
119
119
+
>
120
120
+
Theme
121
121
+
</PubSettingsHeader>
120
122
</form>
121
123
122
124
<div className="themeSetterContent flex flex-col w-full overflow-y-scroll -mb-2 ">