thepopebot 1.2.43 → 1.2.45
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/chat/actions.js +3 -2
- package/lib/chat/components/app-sidebar.js +127 -124
- package/lib/chat/components/app-sidebar.jsx +6 -3
- package/lib/chat/components/index.js +0 -1
- package/lib/chat/components/upgrade-dialog.js +88 -0
- package/lib/chat/components/upgrade-dialog.jsx +105 -0
- package/package.json +1 -1
- package/lib/chat/components/upgrade-page.js +0 -109
- package/lib/chat/components/upgrade-page.jsx +0 -141
- package/templates/app/upgrade/page.js +0 -7
package/lib/chat/actions.js
CHANGED
|
@@ -164,8 +164,9 @@ export async function markNotificationsRead() {
|
|
|
164
164
|
*/
|
|
165
165
|
export async function getAppVersion() {
|
|
166
166
|
await requireAuth();
|
|
167
|
-
const { getInstalledVersion
|
|
168
|
-
|
|
167
|
+
const { getInstalledVersion } = await import('../cron.js');
|
|
168
|
+
const { getAvailableVersion } = await import('../db/update-check.js');
|
|
169
|
+
return { version: getInstalledVersion(), updateAvailable: getAvailableVersion() };
|
|
169
170
|
}
|
|
170
171
|
|
|
171
172
|
/**
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
3
3
|
import { useState, useEffect } from "react";
|
|
4
4
|
import { CirclePlusIcon, PanelLeftIcon, MessageIcon, BellIcon, SwarmIcon, ArrowUpCircleIcon } from "./icons.js";
|
|
5
5
|
import { getUnreadNotificationCount, getAppVersion } from "../actions.js";
|
|
6
6
|
import { SidebarHistory } from "./sidebar-history.js";
|
|
7
7
|
import { SidebarUserNav } from "./sidebar-user-nav.js";
|
|
8
|
+
import { UpgradeDialog } from "./upgrade-dialog.js";
|
|
8
9
|
import {
|
|
9
10
|
Sidebar,
|
|
10
11
|
SidebarContent,
|
|
@@ -26,6 +27,7 @@ function AppSidebar({ user }) {
|
|
|
26
27
|
const [unreadCount, setUnreadCount] = useState(0);
|
|
27
28
|
const [version, setVersion] = useState("");
|
|
28
29
|
const [updateAvailable, setUpdateAvailable] = useState(null);
|
|
30
|
+
const [upgradeOpen, setUpgradeOpen] = useState(false);
|
|
29
31
|
useEffect(() => {
|
|
30
32
|
getUnreadNotificationCount().then((count) => setUnreadCount(count)).catch(() => {
|
|
31
33
|
});
|
|
@@ -35,134 +37,135 @@ function AppSidebar({ user }) {
|
|
|
35
37
|
}).catch(() => {
|
|
36
38
|
});
|
|
37
39
|
}, []);
|
|
38
|
-
return /* @__PURE__ */ jsxs(
|
|
39
|
-
/* @__PURE__ */ jsxs(
|
|
40
|
-
/* @__PURE__ */ jsxs(
|
|
41
|
-
|
|
42
|
-
"
|
|
43
|
-
|
|
44
|
-
"
|
|
45
|
-
|
|
40
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
41
|
+
/* @__PURE__ */ jsxs(Sidebar, { children: [
|
|
42
|
+
/* @__PURE__ */ jsxs(SidebarHeader, { children: [
|
|
43
|
+
/* @__PURE__ */ jsxs("div", { className: collapsed ? "flex justify-center" : "flex items-center justify-between", children: [
|
|
44
|
+
!collapsed && /* @__PURE__ */ jsxs("span", { className: "px-2 font-semibold text-lg", children: [
|
|
45
|
+
"The Pope Bot",
|
|
46
|
+
version && /* @__PURE__ */ jsxs("span", { className: "text-[11px] font-normal text-muted-foreground", children: [
|
|
47
|
+
" v",
|
|
48
|
+
version
|
|
49
|
+
] })
|
|
50
|
+
] }),
|
|
51
|
+
/* @__PURE__ */ jsxs(Tooltip, { children: [
|
|
52
|
+
/* @__PURE__ */ jsx(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsx(
|
|
53
|
+
"button",
|
|
54
|
+
{
|
|
55
|
+
className: "inline-flex shrink-0 items-center justify-center rounded-md p-2 text-muted-foreground hover:bg-background hover:text-foreground",
|
|
56
|
+
onClick: toggleSidebar,
|
|
57
|
+
children: /* @__PURE__ */ jsx(PanelLeftIcon, { size: 16 })
|
|
58
|
+
}
|
|
59
|
+
) }),
|
|
60
|
+
/* @__PURE__ */ jsx(TooltipContent, { side: collapsed ? "right" : "bottom", children: collapsed ? "Open sidebar" : "Close sidebar" })
|
|
46
61
|
] })
|
|
47
62
|
] }),
|
|
48
|
-
/* @__PURE__ */ jsxs(
|
|
49
|
-
/* @__PURE__ */ jsx(
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
63
|
+
/* @__PURE__ */ jsxs(SidebarMenu, { children: [
|
|
64
|
+
/* @__PURE__ */ jsx(SidebarMenuItem, { className: "mb-2", children: /* @__PURE__ */ jsxs(Tooltip, { children: [
|
|
65
|
+
/* @__PURE__ */ jsx(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsxs(
|
|
66
|
+
SidebarMenuButton,
|
|
67
|
+
{
|
|
68
|
+
className: collapsed ? "justify-center" : "",
|
|
69
|
+
onClick: () => {
|
|
70
|
+
navigateToChat(null);
|
|
71
|
+
setOpenMobile(false);
|
|
72
|
+
},
|
|
73
|
+
children: [
|
|
74
|
+
/* @__PURE__ */ jsx(CirclePlusIcon, { size: 16 }),
|
|
75
|
+
!collapsed && /* @__PURE__ */ jsx("span", { children: "New chat" })
|
|
76
|
+
]
|
|
77
|
+
}
|
|
78
|
+
) }),
|
|
79
|
+
collapsed && /* @__PURE__ */ jsx(TooltipContent, { side: "right", children: "New chat" })
|
|
80
|
+
] }) }),
|
|
81
|
+
/* @__PURE__ */ jsx(SidebarMenuItem, { children: /* @__PURE__ */ jsxs(Tooltip, { children: [
|
|
82
|
+
/* @__PURE__ */ jsx(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsxs(
|
|
83
|
+
SidebarMenuButton,
|
|
84
|
+
{
|
|
85
|
+
className: collapsed ? "justify-center" : "",
|
|
86
|
+
onClick: () => {
|
|
87
|
+
window.location.href = "/chats";
|
|
88
|
+
},
|
|
89
|
+
children: [
|
|
90
|
+
/* @__PURE__ */ jsx(MessageIcon, { size: 16 }),
|
|
91
|
+
!collapsed && /* @__PURE__ */ jsx("span", { children: "Chats" })
|
|
92
|
+
]
|
|
93
|
+
}
|
|
94
|
+
) }),
|
|
95
|
+
collapsed && /* @__PURE__ */ jsx(TooltipContent, { side: "right", children: "Chats" })
|
|
96
|
+
] }) }),
|
|
97
|
+
/* @__PURE__ */ jsx(SidebarMenuItem, { children: /* @__PURE__ */ jsxs(Tooltip, { children: [
|
|
98
|
+
/* @__PURE__ */ jsx(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsxs(
|
|
99
|
+
SidebarMenuButton,
|
|
100
|
+
{
|
|
101
|
+
className: collapsed ? "justify-center" : "",
|
|
102
|
+
onClick: () => {
|
|
103
|
+
window.location.href = "/swarm";
|
|
104
|
+
},
|
|
105
|
+
children: [
|
|
106
|
+
/* @__PURE__ */ jsx(SwarmIcon, { size: 16 }),
|
|
107
|
+
!collapsed && /* @__PURE__ */ jsx("span", { children: "Swarm" })
|
|
108
|
+
]
|
|
109
|
+
}
|
|
110
|
+
) }),
|
|
111
|
+
collapsed && /* @__PURE__ */ jsx(TooltipContent, { side: "right", children: "Swarm" })
|
|
112
|
+
] }) }),
|
|
113
|
+
/* @__PURE__ */ jsx(SidebarMenuItem, { children: /* @__PURE__ */ jsxs(Tooltip, { children: [
|
|
114
|
+
/* @__PURE__ */ jsx(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsxs(
|
|
115
|
+
SidebarMenuButton,
|
|
116
|
+
{
|
|
117
|
+
className: collapsed ? "justify-center" : "",
|
|
118
|
+
onClick: () => {
|
|
119
|
+
window.location.href = "/notifications";
|
|
120
|
+
},
|
|
121
|
+
children: [
|
|
122
|
+
/* @__PURE__ */ jsx(BellIcon, { size: 16 }),
|
|
123
|
+
!collapsed && /* @__PURE__ */ jsxs("span", { className: "flex items-center gap-2", children: [
|
|
124
|
+
"Notifications",
|
|
125
|
+
unreadCount > 0 && /* @__PURE__ */ jsx("span", { className: "inline-flex items-center justify-center rounded-full bg-destructive px-1.5 py-0.5 text-[10px] font-medium leading-none text-destructive-foreground", children: unreadCount })
|
|
126
|
+
] }),
|
|
127
|
+
collapsed && unreadCount > 0 && /* @__PURE__ */ jsx("span", { className: "absolute -top-1 -right-1 inline-flex h-4 w-4 items-center justify-center rounded-full bg-destructive text-[10px] font-medium text-destructive-foreground", children: unreadCount })
|
|
128
|
+
]
|
|
129
|
+
}
|
|
130
|
+
) }),
|
|
131
|
+
collapsed && /* @__PURE__ */ jsx(TooltipContent, { side: "right", children: "Notifications" })
|
|
132
|
+
] }) }),
|
|
133
|
+
updateAvailable && /* @__PURE__ */ jsx(SidebarMenuItem, { children: /* @__PURE__ */ jsxs(Tooltip, { children: [
|
|
134
|
+
/* @__PURE__ */ jsx(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsxs(
|
|
135
|
+
SidebarMenuButton,
|
|
136
|
+
{
|
|
137
|
+
className: collapsed ? "justify-center" : "",
|
|
138
|
+
onClick: () => setUpgradeOpen(true),
|
|
139
|
+
children: [
|
|
140
|
+
/* @__PURE__ */ jsxs("span", { className: "relative", children: [
|
|
141
|
+
/* @__PURE__ */ jsx(ArrowUpCircleIcon, { size: 16 }),
|
|
142
|
+
collapsed && /* @__PURE__ */ jsx("span", { className: "absolute -top-1 -right-1 inline-block h-2 w-2 rounded-full bg-blue-500" })
|
|
143
|
+
] }),
|
|
144
|
+
!collapsed && /* @__PURE__ */ jsxs("span", { className: "flex items-center gap-2", children: [
|
|
145
|
+
"Upgrade",
|
|
146
|
+
/* @__PURE__ */ jsxs("span", { className: "inline-flex items-center justify-center rounded-full bg-blue-500 px-1.5 py-0.5 text-[10px] font-medium leading-none text-white", children: [
|
|
147
|
+
"v",
|
|
148
|
+
updateAvailable
|
|
149
|
+
] })
|
|
150
|
+
] })
|
|
151
|
+
]
|
|
152
|
+
}
|
|
153
|
+
) }),
|
|
154
|
+
collapsed && /* @__PURE__ */ jsxs(TooltipContent, { side: "right", children: [
|
|
155
|
+
"Upgrade to v",
|
|
156
|
+
updateAvailable
|
|
157
|
+
] })
|
|
158
|
+
] }) })
|
|
58
159
|
] })
|
|
59
160
|
] }),
|
|
60
|
-
/* @__PURE__ */ jsxs(
|
|
61
|
-
/* @__PURE__ */ jsx(
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
onClick: () => {
|
|
67
|
-
navigateToChat(null);
|
|
68
|
-
setOpenMobile(false);
|
|
69
|
-
},
|
|
70
|
-
children: [
|
|
71
|
-
/* @__PURE__ */ jsx(CirclePlusIcon, { size: 16 }),
|
|
72
|
-
!collapsed && /* @__PURE__ */ jsx("span", { children: "New chat" })
|
|
73
|
-
]
|
|
74
|
-
}
|
|
75
|
-
) }),
|
|
76
|
-
collapsed && /* @__PURE__ */ jsx(TooltipContent, { side: "right", children: "New chat" })
|
|
77
|
-
] }) }),
|
|
78
|
-
/* @__PURE__ */ jsx(SidebarMenuItem, { children: /* @__PURE__ */ jsxs(Tooltip, { children: [
|
|
79
|
-
/* @__PURE__ */ jsx(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsxs(
|
|
80
|
-
SidebarMenuButton,
|
|
81
|
-
{
|
|
82
|
-
className: collapsed ? "justify-center" : "",
|
|
83
|
-
onClick: () => {
|
|
84
|
-
window.location.href = "/chats";
|
|
85
|
-
},
|
|
86
|
-
children: [
|
|
87
|
-
/* @__PURE__ */ jsx(MessageIcon, { size: 16 }),
|
|
88
|
-
!collapsed && /* @__PURE__ */ jsx("span", { children: "Chats" })
|
|
89
|
-
]
|
|
90
|
-
}
|
|
91
|
-
) }),
|
|
92
|
-
collapsed && /* @__PURE__ */ jsx(TooltipContent, { side: "right", children: "Chats" })
|
|
93
|
-
] }) }),
|
|
94
|
-
/* @__PURE__ */ jsx(SidebarMenuItem, { children: /* @__PURE__ */ jsxs(Tooltip, { children: [
|
|
95
|
-
/* @__PURE__ */ jsx(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsxs(
|
|
96
|
-
SidebarMenuButton,
|
|
97
|
-
{
|
|
98
|
-
className: collapsed ? "justify-center" : "",
|
|
99
|
-
onClick: () => {
|
|
100
|
-
window.location.href = "/swarm";
|
|
101
|
-
},
|
|
102
|
-
children: [
|
|
103
|
-
/* @__PURE__ */ jsx(SwarmIcon, { size: 16 }),
|
|
104
|
-
!collapsed && /* @__PURE__ */ jsx("span", { children: "Swarm" })
|
|
105
|
-
]
|
|
106
|
-
}
|
|
107
|
-
) }),
|
|
108
|
-
collapsed && /* @__PURE__ */ jsx(TooltipContent, { side: "right", children: "Swarm" })
|
|
109
|
-
] }) }),
|
|
110
|
-
/* @__PURE__ */ jsx(SidebarMenuItem, { children: /* @__PURE__ */ jsxs(Tooltip, { children: [
|
|
111
|
-
/* @__PURE__ */ jsx(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsxs(
|
|
112
|
-
SidebarMenuButton,
|
|
113
|
-
{
|
|
114
|
-
className: collapsed ? "justify-center" : "",
|
|
115
|
-
onClick: () => {
|
|
116
|
-
window.location.href = "/notifications";
|
|
117
|
-
},
|
|
118
|
-
children: [
|
|
119
|
-
/* @__PURE__ */ jsx(BellIcon, { size: 16 }),
|
|
120
|
-
!collapsed && /* @__PURE__ */ jsxs("span", { className: "flex items-center gap-2", children: [
|
|
121
|
-
"Notifications",
|
|
122
|
-
unreadCount > 0 && /* @__PURE__ */ jsx("span", { className: "inline-flex items-center justify-center rounded-full bg-destructive px-1.5 py-0.5 text-[10px] font-medium leading-none text-destructive-foreground", children: unreadCount })
|
|
123
|
-
] }),
|
|
124
|
-
collapsed && unreadCount > 0 && /* @__PURE__ */ jsx("span", { className: "absolute -top-1 -right-1 inline-flex h-4 w-4 items-center justify-center rounded-full bg-destructive text-[10px] font-medium text-destructive-foreground", children: unreadCount })
|
|
125
|
-
]
|
|
126
|
-
}
|
|
127
|
-
) }),
|
|
128
|
-
collapsed && /* @__PURE__ */ jsx(TooltipContent, { side: "right", children: "Notifications" })
|
|
129
|
-
] }) }),
|
|
130
|
-
updateAvailable && /* @__PURE__ */ jsx(SidebarMenuItem, { children: /* @__PURE__ */ jsxs(Tooltip, { children: [
|
|
131
|
-
/* @__PURE__ */ jsx(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsxs(
|
|
132
|
-
SidebarMenuButton,
|
|
133
|
-
{
|
|
134
|
-
className: collapsed ? "justify-center" : "",
|
|
135
|
-
onClick: () => {
|
|
136
|
-
window.location.href = "/upgrade";
|
|
137
|
-
},
|
|
138
|
-
children: [
|
|
139
|
-
/* @__PURE__ */ jsxs("span", { className: "relative", children: [
|
|
140
|
-
/* @__PURE__ */ jsx(ArrowUpCircleIcon, { size: 16 }),
|
|
141
|
-
collapsed && /* @__PURE__ */ jsx("span", { className: "absolute -top-1 -right-1 inline-block h-2 w-2 rounded-full bg-blue-500" })
|
|
142
|
-
] }),
|
|
143
|
-
!collapsed && /* @__PURE__ */ jsxs("span", { className: "flex items-center gap-2", children: [
|
|
144
|
-
"Upgrade",
|
|
145
|
-
/* @__PURE__ */ jsxs("span", { className: "inline-flex items-center justify-center rounded-full bg-blue-500 px-1.5 py-0.5 text-[10px] font-medium leading-none text-white", children: [
|
|
146
|
-
"v",
|
|
147
|
-
updateAvailable
|
|
148
|
-
] })
|
|
149
|
-
] })
|
|
150
|
-
]
|
|
151
|
-
}
|
|
152
|
-
) }),
|
|
153
|
-
collapsed && /* @__PURE__ */ jsxs(TooltipContent, { side: "right", children: [
|
|
154
|
-
"Upgrade to v",
|
|
155
|
-
updateAvailable
|
|
156
|
-
] })
|
|
157
|
-
] }) })
|
|
158
|
-
] })
|
|
159
|
-
] }),
|
|
160
|
-
!collapsed && /* @__PURE__ */ jsxs(SidebarContent, { children: [
|
|
161
|
-
/* @__PURE__ */ jsx(SidebarGroup, { className: "pt-0", children: /* @__PURE__ */ jsx(SidebarGroupLabel, { children: "Chats" }) }),
|
|
162
|
-
/* @__PURE__ */ jsx(SidebarHistory, {})
|
|
161
|
+
!collapsed && /* @__PURE__ */ jsxs(SidebarContent, { children: [
|
|
162
|
+
/* @__PURE__ */ jsx(SidebarGroup, { className: "pt-0", children: /* @__PURE__ */ jsx(SidebarGroupLabel, { children: "Chats" }) }),
|
|
163
|
+
/* @__PURE__ */ jsx(SidebarHistory, {})
|
|
164
|
+
] }),
|
|
165
|
+
collapsed && /* @__PURE__ */ jsx("div", { className: "flex-1" }),
|
|
166
|
+
/* @__PURE__ */ jsx(SidebarFooter, { children: user && /* @__PURE__ */ jsx(SidebarUserNav, { user, collapsed }) })
|
|
163
167
|
] }),
|
|
164
|
-
|
|
165
|
-
/* @__PURE__ */ jsx(SidebarFooter, { children: user && /* @__PURE__ */ jsx(SidebarUserNav, { user, collapsed }) })
|
|
168
|
+
/* @__PURE__ */ jsx(UpgradeDialog, { open: upgradeOpen, onClose: () => setUpgradeOpen(false), version, updateAvailable })
|
|
166
169
|
] });
|
|
167
170
|
}
|
|
168
171
|
export {
|
|
@@ -5,6 +5,7 @@ import { CirclePlusIcon, PanelLeftIcon, MessageIcon, BellIcon, SwarmIcon, ArrowU
|
|
|
5
5
|
import { getUnreadNotificationCount, getAppVersion } from '../actions.js';
|
|
6
6
|
import { SidebarHistory } from './sidebar-history.js';
|
|
7
7
|
import { SidebarUserNav } from './sidebar-user-nav.js';
|
|
8
|
+
import { UpgradeDialog } from './upgrade-dialog.js';
|
|
8
9
|
import {
|
|
9
10
|
Sidebar,
|
|
10
11
|
SidebarContent,
|
|
@@ -27,6 +28,7 @@ export function AppSidebar({ user }) {
|
|
|
27
28
|
const [unreadCount, setUnreadCount] = useState(0);
|
|
28
29
|
const [version, setVersion] = useState('');
|
|
29
30
|
const [updateAvailable, setUpdateAvailable] = useState(null);
|
|
31
|
+
const [upgradeOpen, setUpgradeOpen] = useState(false);
|
|
30
32
|
|
|
31
33
|
useEffect(() => {
|
|
32
34
|
getUnreadNotificationCount()
|
|
@@ -41,6 +43,7 @@ export function AppSidebar({ user }) {
|
|
|
41
43
|
}, []);
|
|
42
44
|
|
|
43
45
|
return (
|
|
46
|
+
<>
|
|
44
47
|
<Sidebar>
|
|
45
48
|
<SidebarHeader>
|
|
46
49
|
{/* Top row: brand name + toggle icon (open) or just toggle icon (collapsed) */}
|
|
@@ -166,9 +169,7 @@ export function AppSidebar({ user }) {
|
|
|
166
169
|
<TooltipTrigger asChild>
|
|
167
170
|
<SidebarMenuButton
|
|
168
171
|
className={collapsed ? 'justify-center' : ''}
|
|
169
|
-
onClick={() =>
|
|
170
|
-
window.location.href = '/upgrade';
|
|
171
|
-
}}
|
|
172
|
+
onClick={() => setUpgradeOpen(true)}
|
|
172
173
|
>
|
|
173
174
|
<span className="relative">
|
|
174
175
|
<ArrowUpCircleIcon size={16} />
|
|
@@ -212,5 +213,7 @@ export function AppSidebar({ user }) {
|
|
|
212
213
|
{user && <SidebarUserNav user={user} collapsed={collapsed} />}
|
|
213
214
|
</SidebarFooter>
|
|
214
215
|
</Sidebar>
|
|
216
|
+
<UpgradeDialog open={upgradeOpen} onClose={() => setUpgradeOpen(false)} version={version} updateAvailable={updateAvailable} />
|
|
217
|
+
</>
|
|
215
218
|
);
|
|
216
219
|
}
|
|
@@ -2,7 +2,6 @@ export { ChatPage } from './chat-page.js';
|
|
|
2
2
|
export { ChatsPage } from './chats-page.js';
|
|
3
3
|
export { NotificationsPage } from './notifications-page.js';
|
|
4
4
|
export { SwarmPage } from './swarm-page.js';
|
|
5
|
-
export { UpgradePage } from './upgrade-page.js';
|
|
6
5
|
export { CronsPage } from './crons-page.js';
|
|
7
6
|
export { TriggersPage } from './triggers-page.js';
|
|
8
7
|
export { PageLayout } from './page-layout.js';
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { useState, useEffect, useCallback } from "react";
|
|
4
|
+
import { ArrowUpCircleIcon, SpinnerIcon, CheckIcon, XIcon } from "./icons.js";
|
|
5
|
+
import { triggerUpgrade } from "../actions.js";
|
|
6
|
+
function UpgradeDialog({ open, onClose, version, updateAvailable }) {
|
|
7
|
+
const [upgrading, setUpgrading] = useState(false);
|
|
8
|
+
const [result, setResult] = useState(null);
|
|
9
|
+
const handleClose = useCallback(() => onClose(), [onClose]);
|
|
10
|
+
useEffect(() => {
|
|
11
|
+
if (!open) return;
|
|
12
|
+
const handleEsc = (e) => {
|
|
13
|
+
if (e.key === "Escape") handleClose();
|
|
14
|
+
};
|
|
15
|
+
document.addEventListener("keydown", handleEsc);
|
|
16
|
+
return () => document.removeEventListener("keydown", handleEsc);
|
|
17
|
+
}, [open, handleClose]);
|
|
18
|
+
useEffect(() => {
|
|
19
|
+
if (!open) {
|
|
20
|
+
setUpgrading(false);
|
|
21
|
+
setResult(null);
|
|
22
|
+
}
|
|
23
|
+
}, [open]);
|
|
24
|
+
if (!open) return null;
|
|
25
|
+
const handleUpgrade = async () => {
|
|
26
|
+
setUpgrading(true);
|
|
27
|
+
setResult(null);
|
|
28
|
+
try {
|
|
29
|
+
await triggerUpgrade();
|
|
30
|
+
setResult("success");
|
|
31
|
+
} catch {
|
|
32
|
+
setResult("error");
|
|
33
|
+
} finally {
|
|
34
|
+
setUpgrading(false);
|
|
35
|
+
}
|
|
36
|
+
};
|
|
37
|
+
return /* @__PURE__ */ jsxs("div", { className: "fixed inset-0 z-50 flex items-center justify-center", children: [
|
|
38
|
+
/* @__PURE__ */ jsx("div", { className: "fixed inset-0 bg-black/50", onClick: handleClose }),
|
|
39
|
+
/* @__PURE__ */ jsxs("div", { className: "relative z-50 w-full max-w-sm rounded-lg border border-border bg-background p-6 shadow-lg", onClick: (e) => e.stopPropagation(), children: [
|
|
40
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between mb-4", children: [
|
|
41
|
+
/* @__PURE__ */ jsx("h3", { className: "text-lg font-semibold", children: "Upgrade Available" }),
|
|
42
|
+
/* @__PURE__ */ jsx("button", { onClick: handleClose, className: "text-muted-foreground hover:text-foreground", children: /* @__PURE__ */ jsx(XIcon, { size: 16 }) })
|
|
43
|
+
] }),
|
|
44
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-3 mb-4", children: [
|
|
45
|
+
/* @__PURE__ */ jsx(ArrowUpCircleIcon, { size: 24 }),
|
|
46
|
+
/* @__PURE__ */ jsxs("div", { children: [
|
|
47
|
+
/* @__PURE__ */ jsx("p", { className: "text-sm text-muted-foreground", children: "Installed version" }),
|
|
48
|
+
/* @__PURE__ */ jsxs("p", { className: "text-lg font-mono font-semibold", children: [
|
|
49
|
+
"v",
|
|
50
|
+
version
|
|
51
|
+
] })
|
|
52
|
+
] })
|
|
53
|
+
] }),
|
|
54
|
+
/* @__PURE__ */ jsx("div", { className: "rounded-md border border-blue-500/30 bg-blue-500/5 p-3 mb-4", children: /* @__PURE__ */ jsxs("p", { className: "text-sm font-medium", children: [
|
|
55
|
+
"Version ",
|
|
56
|
+
/* @__PURE__ */ jsxs("span", { className: "font-mono text-blue-500", children: [
|
|
57
|
+
"v",
|
|
58
|
+
updateAvailable
|
|
59
|
+
] }),
|
|
60
|
+
" is available"
|
|
61
|
+
] }) }),
|
|
62
|
+
/* @__PURE__ */ jsx(
|
|
63
|
+
"button",
|
|
64
|
+
{
|
|
65
|
+
onClick: handleUpgrade,
|
|
66
|
+
disabled: upgrading || result === "success",
|
|
67
|
+
className: "w-full inline-flex items-center justify-center gap-2 rounded-md px-4 py-2.5 text-sm font-medium bg-blue-500 text-white hover:bg-blue-600 disabled:opacity-50 disabled:pointer-events-none",
|
|
68
|
+
children: upgrading ? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
69
|
+
/* @__PURE__ */ jsx(SpinnerIcon, { size: 16 }),
|
|
70
|
+
"Triggering upgrade..."
|
|
71
|
+
] }) : result === "success" ? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
72
|
+
/* @__PURE__ */ jsx(CheckIcon, { size: 16 }),
|
|
73
|
+
"Upgrade triggered"
|
|
74
|
+
] }) : /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
75
|
+
/* @__PURE__ */ jsx(ArrowUpCircleIcon, { size: 16 }),
|
|
76
|
+
"Upgrade to v",
|
|
77
|
+
updateAvailable
|
|
78
|
+
] })
|
|
79
|
+
}
|
|
80
|
+
),
|
|
81
|
+
result === "success" && /* @__PURE__ */ jsx("p", { className: "text-xs text-muted-foreground mt-3", children: "The upgrade workflow has been triggered. The server will update, rebuild, and reload automatically." }),
|
|
82
|
+
result === "error" && /* @__PURE__ */ jsx("p", { className: "text-xs text-red-500 mt-3", children: "Failed to trigger the upgrade workflow. Check that your GitHub token has workflow permissions." })
|
|
83
|
+
] })
|
|
84
|
+
] });
|
|
85
|
+
}
|
|
86
|
+
export {
|
|
87
|
+
UpgradeDialog
|
|
88
|
+
};
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import { useState, useEffect, useCallback } from 'react';
|
|
4
|
+
import { ArrowUpCircleIcon, SpinnerIcon, CheckIcon, XIcon } from './icons.js';
|
|
5
|
+
import { triggerUpgrade } from '../actions.js';
|
|
6
|
+
|
|
7
|
+
export function UpgradeDialog({ open, onClose, version, updateAvailable }) {
|
|
8
|
+
const [upgrading, setUpgrading] = useState(false);
|
|
9
|
+
const [result, setResult] = useState(null);
|
|
10
|
+
|
|
11
|
+
const handleClose = useCallback(() => onClose(), [onClose]);
|
|
12
|
+
|
|
13
|
+
useEffect(() => {
|
|
14
|
+
if (!open) return;
|
|
15
|
+
const handleEsc = (e) => {
|
|
16
|
+
if (e.key === 'Escape') handleClose();
|
|
17
|
+
};
|
|
18
|
+
document.addEventListener('keydown', handleEsc);
|
|
19
|
+
return () => document.removeEventListener('keydown', handleEsc);
|
|
20
|
+
}, [open, handleClose]);
|
|
21
|
+
|
|
22
|
+
useEffect(() => {
|
|
23
|
+
if (!open) {
|
|
24
|
+
setUpgrading(false);
|
|
25
|
+
setResult(null);
|
|
26
|
+
}
|
|
27
|
+
}, [open]);
|
|
28
|
+
|
|
29
|
+
if (!open) return null;
|
|
30
|
+
|
|
31
|
+
const handleUpgrade = async () => {
|
|
32
|
+
setUpgrading(true);
|
|
33
|
+
setResult(null);
|
|
34
|
+
try {
|
|
35
|
+
await triggerUpgrade();
|
|
36
|
+
setResult('success');
|
|
37
|
+
} catch {
|
|
38
|
+
setResult('error');
|
|
39
|
+
} finally {
|
|
40
|
+
setUpgrading(false);
|
|
41
|
+
}
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
return (
|
|
45
|
+
<div className="fixed inset-0 z-50 flex items-center justify-center">
|
|
46
|
+
<div className="fixed inset-0 bg-black/50" onClick={handleClose} />
|
|
47
|
+
<div className="relative z-50 w-full max-w-sm rounded-lg border border-border bg-background p-6 shadow-lg" onClick={(e) => e.stopPropagation()}>
|
|
48
|
+
<div className="flex items-center justify-between mb-4">
|
|
49
|
+
<h3 className="text-lg font-semibold">Upgrade Available</h3>
|
|
50
|
+
<button onClick={handleClose} className="text-muted-foreground hover:text-foreground">
|
|
51
|
+
<XIcon size={16} />
|
|
52
|
+
</button>
|
|
53
|
+
</div>
|
|
54
|
+
|
|
55
|
+
<div className="flex items-center gap-3 mb-4">
|
|
56
|
+
<ArrowUpCircleIcon size={24} />
|
|
57
|
+
<div>
|
|
58
|
+
<p className="text-sm text-muted-foreground">Installed version</p>
|
|
59
|
+
<p className="text-lg font-mono font-semibold">v{version}</p>
|
|
60
|
+
</div>
|
|
61
|
+
</div>
|
|
62
|
+
|
|
63
|
+
<div className="rounded-md border border-blue-500/30 bg-blue-500/5 p-3 mb-4">
|
|
64
|
+
<p className="text-sm font-medium">
|
|
65
|
+
Version <span className="font-mono text-blue-500">v{updateAvailable}</span> is available
|
|
66
|
+
</p>
|
|
67
|
+
</div>
|
|
68
|
+
|
|
69
|
+
<button
|
|
70
|
+
onClick={handleUpgrade}
|
|
71
|
+
disabled={upgrading || result === 'success'}
|
|
72
|
+
className="w-full inline-flex items-center justify-center gap-2 rounded-md px-4 py-2.5 text-sm font-medium bg-blue-500 text-white hover:bg-blue-600 disabled:opacity-50 disabled:pointer-events-none"
|
|
73
|
+
>
|
|
74
|
+
{upgrading ? (
|
|
75
|
+
<>
|
|
76
|
+
<SpinnerIcon size={16} />
|
|
77
|
+
Triggering upgrade...
|
|
78
|
+
</>
|
|
79
|
+
) : result === 'success' ? (
|
|
80
|
+
<>
|
|
81
|
+
<CheckIcon size={16} />
|
|
82
|
+
Upgrade triggered
|
|
83
|
+
</>
|
|
84
|
+
) : (
|
|
85
|
+
<>
|
|
86
|
+
<ArrowUpCircleIcon size={16} />
|
|
87
|
+
Upgrade to v{updateAvailable}
|
|
88
|
+
</>
|
|
89
|
+
)}
|
|
90
|
+
</button>
|
|
91
|
+
|
|
92
|
+
{result === 'success' && (
|
|
93
|
+
<p className="text-xs text-muted-foreground mt-3">
|
|
94
|
+
The upgrade workflow has been triggered. The server will update, rebuild, and reload automatically.
|
|
95
|
+
</p>
|
|
96
|
+
)}
|
|
97
|
+
{result === 'error' && (
|
|
98
|
+
<p className="text-xs text-red-500 mt-3">
|
|
99
|
+
Failed to trigger the upgrade workflow. Check that your GitHub token has workflow permissions.
|
|
100
|
+
</p>
|
|
101
|
+
)}
|
|
102
|
+
</div>
|
|
103
|
+
</div>
|
|
104
|
+
);
|
|
105
|
+
}
|
package/package.json
CHANGED
|
@@ -1,109 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
3
|
-
import { useState, useEffect } from "react";
|
|
4
|
-
import { PageLayout } from "./page-layout.js";
|
|
5
|
-
import { ArrowUpCircleIcon, SpinnerIcon, CheckIcon } from "./icons.js";
|
|
6
|
-
import { getAppVersion, triggerUpgrade } from "../actions.js";
|
|
7
|
-
function UpgradePage({ session }) {
|
|
8
|
-
const [version, setVersion] = useState("");
|
|
9
|
-
const [updateAvailable, setUpdateAvailable] = useState(null);
|
|
10
|
-
const [loading, setLoading] = useState(true);
|
|
11
|
-
const [upgrading, setUpgrading] = useState(false);
|
|
12
|
-
const [result, setResult] = useState(null);
|
|
13
|
-
useEffect(() => {
|
|
14
|
-
getAppVersion().then(({ version: version2, updateAvailable: updateAvailable2 }) => {
|
|
15
|
-
setVersion(version2);
|
|
16
|
-
setUpdateAvailable(updateAvailable2);
|
|
17
|
-
}).catch(() => {
|
|
18
|
-
}).finally(() => setLoading(false));
|
|
19
|
-
}, []);
|
|
20
|
-
const handleUpgrade = async () => {
|
|
21
|
-
setUpgrading(true);
|
|
22
|
-
setResult(null);
|
|
23
|
-
try {
|
|
24
|
-
await triggerUpgrade();
|
|
25
|
-
setResult("success");
|
|
26
|
-
} catch {
|
|
27
|
-
setResult("error");
|
|
28
|
-
} finally {
|
|
29
|
-
setUpgrading(false);
|
|
30
|
-
}
|
|
31
|
-
};
|
|
32
|
-
return /* @__PURE__ */ jsxs(PageLayout, { session, children: [
|
|
33
|
-
/* @__PURE__ */ jsx("div", { className: "flex items-center justify-between mb-6", children: /* @__PURE__ */ jsx("h1", { className: "text-2xl font-semibold", children: "Upgrade" }) }),
|
|
34
|
-
loading ? /* @__PURE__ */ jsx("div", { className: "flex flex-col gap-4", children: /* @__PURE__ */ jsx("div", { className: "h-32 animate-pulse rounded-md bg-border/50" }) }) : /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-6 max-w-lg", children: [
|
|
35
|
-
/* @__PURE__ */ jsxs("div", { className: "rounded-md border bg-card p-6", children: [
|
|
36
|
-
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-3 mb-4", children: [
|
|
37
|
-
/* @__PURE__ */ jsx(ArrowUpCircleIcon, { size: 24 }),
|
|
38
|
-
/* @__PURE__ */ jsxs("div", { children: [
|
|
39
|
-
/* @__PURE__ */ jsx("p", { className: "text-sm text-muted-foreground", children: "Installed version" }),
|
|
40
|
-
/* @__PURE__ */ jsxs("p", { className: "text-lg font-mono font-semibold", children: [
|
|
41
|
-
"v",
|
|
42
|
-
version
|
|
43
|
-
] })
|
|
44
|
-
] })
|
|
45
|
-
] }),
|
|
46
|
-
updateAvailable ? /* @__PURE__ */ jsx("div", { className: "rounded-md border border-blue-500/30 bg-blue-500/5 p-4 mb-4", children: /* @__PURE__ */ jsxs("p", { className: "text-sm font-medium", children: [
|
|
47
|
-
"Version ",
|
|
48
|
-
/* @__PURE__ */ jsxs("span", { className: "font-mono text-blue-500", children: [
|
|
49
|
-
"v",
|
|
50
|
-
updateAvailable
|
|
51
|
-
] }),
|
|
52
|
-
" is available"
|
|
53
|
-
] }) }) : /* @__PURE__ */ jsx("div", { className: "rounded-md border border-green-500/30 bg-green-500/5 p-4 mb-4", children: /* @__PURE__ */ jsx("p", { className: "text-sm font-medium text-green-600 dark:text-green-400", children: "You are on the latest version" }) }),
|
|
54
|
-
updateAvailable && /* @__PURE__ */ jsx(
|
|
55
|
-
"button",
|
|
56
|
-
{
|
|
57
|
-
onClick: handleUpgrade,
|
|
58
|
-
disabled: upgrading || result === "success",
|
|
59
|
-
className: "w-full inline-flex items-center justify-center gap-2 rounded-md px-4 py-2.5 text-sm font-medium bg-blue-500 text-white hover:bg-blue-600 disabled:opacity-50 disabled:pointer-events-none",
|
|
60
|
-
children: upgrading ? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
61
|
-
/* @__PURE__ */ jsx(SpinnerIcon, { size: 16 }),
|
|
62
|
-
"Triggering upgrade..."
|
|
63
|
-
] }) : result === "success" ? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
64
|
-
/* @__PURE__ */ jsx(CheckIcon, { size: 16 }),
|
|
65
|
-
"Upgrade triggered"
|
|
66
|
-
] }) : /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
67
|
-
/* @__PURE__ */ jsx(ArrowUpCircleIcon, { size: 16 }),
|
|
68
|
-
"Upgrade to v",
|
|
69
|
-
updateAvailable
|
|
70
|
-
] })
|
|
71
|
-
}
|
|
72
|
-
),
|
|
73
|
-
result === "success" && /* @__PURE__ */ jsx("p", { className: "text-xs text-muted-foreground mt-3", children: "The upgrade workflow has been triggered. The server will update, rebuild, and reload automatically. This page will reflect the new version once the process completes." }),
|
|
74
|
-
result === "error" && /* @__PURE__ */ jsx("p", { className: "text-xs text-red-500 mt-3", children: "Failed to trigger the upgrade workflow. Check that your GitHub token has workflow permissions." })
|
|
75
|
-
] }),
|
|
76
|
-
updateAvailable && /* @__PURE__ */ jsxs("div", { className: "rounded-md border bg-card p-6", children: [
|
|
77
|
-
/* @__PURE__ */ jsx("h2", { className: "text-sm font-medium mb-3", children: "What happens during an upgrade" }),
|
|
78
|
-
/* @__PURE__ */ jsxs("ul", { className: "text-sm text-muted-foreground space-y-2", children: [
|
|
79
|
-
/* @__PURE__ */ jsxs("li", { className: "flex gap-2", children: [
|
|
80
|
-
/* @__PURE__ */ jsx("span", { className: "text-muted-foreground/60", children: "1." }),
|
|
81
|
-
/* @__PURE__ */ jsxs("span", { children: [
|
|
82
|
-
"The ",
|
|
83
|
-
/* @__PURE__ */ jsx("code", { className: "text-xs bg-muted px-1 py-0.5 rounded", children: "upgrade-event-handler" }),
|
|
84
|
-
" GitHub Actions workflow is triggered"
|
|
85
|
-
] })
|
|
86
|
-
] }),
|
|
87
|
-
/* @__PURE__ */ jsxs("li", { className: "flex gap-2", children: [
|
|
88
|
-
/* @__PURE__ */ jsx("span", { className: "text-muted-foreground/60", children: "2." }),
|
|
89
|
-
/* @__PURE__ */ jsxs("span", { children: [
|
|
90
|
-
"The package is updated via ",
|
|
91
|
-
/* @__PURE__ */ jsx("code", { className: "text-xs bg-muted px-1 py-0.5 rounded", children: "npm update thepopebot" })
|
|
92
|
-
] })
|
|
93
|
-
] }),
|
|
94
|
-
/* @__PURE__ */ jsxs("li", { className: "flex gap-2", children: [
|
|
95
|
-
/* @__PURE__ */ jsx("span", { className: "text-muted-foreground/60", children: "3." }),
|
|
96
|
-
/* @__PURE__ */ jsx("span", { children: "A new build is created alongside the current one" })
|
|
97
|
-
] }),
|
|
98
|
-
/* @__PURE__ */ jsxs("li", { className: "flex gap-2", children: [
|
|
99
|
-
/* @__PURE__ */ jsx("span", { className: "text-muted-foreground/60", children: "4." }),
|
|
100
|
-
/* @__PURE__ */ jsx("span", { children: "The builds are atomically swapped and the server reloads" })
|
|
101
|
-
] })
|
|
102
|
-
] })
|
|
103
|
-
] })
|
|
104
|
-
] })
|
|
105
|
-
] });
|
|
106
|
-
}
|
|
107
|
-
export {
|
|
108
|
-
UpgradePage
|
|
109
|
-
};
|
|
@@ -1,141 +0,0 @@
|
|
|
1
|
-
'use client';
|
|
2
|
-
|
|
3
|
-
import { useState, useEffect } from 'react';
|
|
4
|
-
import { PageLayout } from './page-layout.js';
|
|
5
|
-
import { ArrowUpCircleIcon, SpinnerIcon, CheckIcon } from './icons.js';
|
|
6
|
-
import { getAppVersion, triggerUpgrade } from '../actions.js';
|
|
7
|
-
|
|
8
|
-
export function UpgradePage({ session }) {
|
|
9
|
-
const [version, setVersion] = useState('');
|
|
10
|
-
const [updateAvailable, setUpdateAvailable] = useState(null);
|
|
11
|
-
const [loading, setLoading] = useState(true);
|
|
12
|
-
const [upgrading, setUpgrading] = useState(false);
|
|
13
|
-
const [result, setResult] = useState(null); // 'success' | 'error'
|
|
14
|
-
|
|
15
|
-
useEffect(() => {
|
|
16
|
-
getAppVersion()
|
|
17
|
-
.then(({ version, updateAvailable }) => {
|
|
18
|
-
setVersion(version);
|
|
19
|
-
setUpdateAvailable(updateAvailable);
|
|
20
|
-
})
|
|
21
|
-
.catch(() => {})
|
|
22
|
-
.finally(() => setLoading(false));
|
|
23
|
-
}, []);
|
|
24
|
-
|
|
25
|
-
const handleUpgrade = async () => {
|
|
26
|
-
setUpgrading(true);
|
|
27
|
-
setResult(null);
|
|
28
|
-
try {
|
|
29
|
-
await triggerUpgrade();
|
|
30
|
-
setResult('success');
|
|
31
|
-
} catch {
|
|
32
|
-
setResult('error');
|
|
33
|
-
} finally {
|
|
34
|
-
setUpgrading(false);
|
|
35
|
-
}
|
|
36
|
-
};
|
|
37
|
-
|
|
38
|
-
return (
|
|
39
|
-
<PageLayout session={session}>
|
|
40
|
-
<div className="flex items-center justify-between mb-6">
|
|
41
|
-
<h1 className="text-2xl font-semibold">Upgrade</h1>
|
|
42
|
-
</div>
|
|
43
|
-
|
|
44
|
-
{loading ? (
|
|
45
|
-
<div className="flex flex-col gap-4">
|
|
46
|
-
<div className="h-32 animate-pulse rounded-md bg-border/50" />
|
|
47
|
-
</div>
|
|
48
|
-
) : (
|
|
49
|
-
<div className="flex flex-col gap-6 max-w-lg">
|
|
50
|
-
{/* Version info card */}
|
|
51
|
-
<div className="rounded-md border bg-card p-6">
|
|
52
|
-
<div className="flex items-center gap-3 mb-4">
|
|
53
|
-
<ArrowUpCircleIcon size={24} />
|
|
54
|
-
<div>
|
|
55
|
-
<p className="text-sm text-muted-foreground">Installed version</p>
|
|
56
|
-
<p className="text-lg font-mono font-semibold">v{version}</p>
|
|
57
|
-
</div>
|
|
58
|
-
</div>
|
|
59
|
-
|
|
60
|
-
{updateAvailable ? (
|
|
61
|
-
<div className="rounded-md border border-blue-500/30 bg-blue-500/5 p-4 mb-4">
|
|
62
|
-
<p className="text-sm font-medium">
|
|
63
|
-
Version <span className="font-mono text-blue-500">v{updateAvailable}</span> is available
|
|
64
|
-
</p>
|
|
65
|
-
</div>
|
|
66
|
-
) : (
|
|
67
|
-
<div className="rounded-md border border-green-500/30 bg-green-500/5 p-4 mb-4">
|
|
68
|
-
<p className="text-sm font-medium text-green-600 dark:text-green-400">
|
|
69
|
-
You are on the latest version
|
|
70
|
-
</p>
|
|
71
|
-
</div>
|
|
72
|
-
)}
|
|
73
|
-
|
|
74
|
-
{/* Upgrade button */}
|
|
75
|
-
{updateAvailable && (
|
|
76
|
-
<button
|
|
77
|
-
onClick={handleUpgrade}
|
|
78
|
-
disabled={upgrading || result === 'success'}
|
|
79
|
-
className="w-full inline-flex items-center justify-center gap-2 rounded-md px-4 py-2.5 text-sm font-medium bg-blue-500 text-white hover:bg-blue-600 disabled:opacity-50 disabled:pointer-events-none"
|
|
80
|
-
>
|
|
81
|
-
{upgrading ? (
|
|
82
|
-
<>
|
|
83
|
-
<SpinnerIcon size={16} />
|
|
84
|
-
Triggering upgrade...
|
|
85
|
-
</>
|
|
86
|
-
) : result === 'success' ? (
|
|
87
|
-
<>
|
|
88
|
-
<CheckIcon size={16} />
|
|
89
|
-
Upgrade triggered
|
|
90
|
-
</>
|
|
91
|
-
) : (
|
|
92
|
-
<>
|
|
93
|
-
<ArrowUpCircleIcon size={16} />
|
|
94
|
-
Upgrade to v{updateAvailable}
|
|
95
|
-
</>
|
|
96
|
-
)}
|
|
97
|
-
</button>
|
|
98
|
-
)}
|
|
99
|
-
|
|
100
|
-
{/* Feedback */}
|
|
101
|
-
{result === 'success' && (
|
|
102
|
-
<p className="text-xs text-muted-foreground mt-3">
|
|
103
|
-
The upgrade workflow has been triggered. The server will update, rebuild, and reload automatically. This page will reflect the new version once the process completes.
|
|
104
|
-
</p>
|
|
105
|
-
)}
|
|
106
|
-
{result === 'error' && (
|
|
107
|
-
<p className="text-xs text-red-500 mt-3">
|
|
108
|
-
Failed to trigger the upgrade workflow. Check that your GitHub token has workflow permissions.
|
|
109
|
-
</p>
|
|
110
|
-
)}
|
|
111
|
-
</div>
|
|
112
|
-
|
|
113
|
-
{/* What happens during upgrade */}
|
|
114
|
-
{updateAvailable && (
|
|
115
|
-
<div className="rounded-md border bg-card p-6">
|
|
116
|
-
<h2 className="text-sm font-medium mb-3">What happens during an upgrade</h2>
|
|
117
|
-
<ul className="text-sm text-muted-foreground space-y-2">
|
|
118
|
-
<li className="flex gap-2">
|
|
119
|
-
<span className="text-muted-foreground/60">1.</span>
|
|
120
|
-
<span>The <code className="text-xs bg-muted px-1 py-0.5 rounded">upgrade-event-handler</code> GitHub Actions workflow is triggered</span>
|
|
121
|
-
</li>
|
|
122
|
-
<li className="flex gap-2">
|
|
123
|
-
<span className="text-muted-foreground/60">2.</span>
|
|
124
|
-
<span>The package is updated via <code className="text-xs bg-muted px-1 py-0.5 rounded">npm update thepopebot</code></span>
|
|
125
|
-
</li>
|
|
126
|
-
<li className="flex gap-2">
|
|
127
|
-
<span className="text-muted-foreground/60">3.</span>
|
|
128
|
-
<span>A new build is created alongside the current one</span>
|
|
129
|
-
</li>
|
|
130
|
-
<li className="flex gap-2">
|
|
131
|
-
<span className="text-muted-foreground/60">4.</span>
|
|
132
|
-
<span>The builds are atomically swapped and the server reloads</span>
|
|
133
|
-
</li>
|
|
134
|
-
</ul>
|
|
135
|
-
</div>
|
|
136
|
-
)}
|
|
137
|
-
</div>
|
|
138
|
-
)}
|
|
139
|
-
</PageLayout>
|
|
140
|
-
);
|
|
141
|
-
}
|