Option to disable page share

This commit is contained in:
n4ze3m 2024-04-30 20:43:53 +05:30
parent ad5601a038
commit b09fbcdfe6
7 changed files with 40 additions and 11 deletions

View File

@ -193,7 +193,9 @@
},
"confirm": {
"delete": "Are you sure you want to delete this share? This action cannot be undone."
}
},
"label": "Manage Page Share",
"description": "Enable or disable the page share feature. By default, the page share feature is enabled."
},
"notification": {
"pageShareSuccess": "Page Share URL updated successfully",

View File

@ -196,7 +196,9 @@
},
"confirm": {
"delete": "本当にこの共有を削除しますか?この操作は元に戻せません。"
}
},
"label": "ページ共有を管理する",
"description": "ページ共有機能を有効または無効にします。デフォルトでは、ページ共有機能は有効になっています。"
},
"notification": {
"pageShareSuccess": "ページ共有URLが正常に更新されました",

View File

@ -196,7 +196,9 @@
},
"confirm": {
"delete": "ഈ പങ്കിടല്‍ ഇല്ലാതാക്കണമെന്ന് തീർച്ചയാണോ? ഈ പ്രവർത്തനം പിന്നീട് പിൻവലിക്കാനാകില്ല."
}
},
"label": "പേജ് ഷെയർ നിയന്ത്രിക്കുക",
"description": "പേജ് ഷെയർ സവിശേഷത സജീവമാക്കുകയോ അക്ഷമമാക്കുകയോ ചെയ്യുക. സ്ഥിരംമായി, പേജ് ഷെയർ സവിശേഷത സജീവമാക്കപ്പെടുന്നു."
},
"notification": {
"pageShareSuccess": "പേജ് പങ്കിടാനുള്ള URL വിജയകരമായി അപ്ഡേറ്റ് ചെയ്തു",

View File

@ -193,7 +193,9 @@
},
"confirm": {
"delete": "Вы уверены, что хотите удалить этот обмен? Это действие нельзя отменить."
}
},
"label": "Управление общим доступом к странице",
"description": "Включите или отключите функцию общего доступа к странице. По умолчанию функция общего доступа к странице включена."
},
"notification": {
"pageShareSuccess": "URL обмена страницей успешно обновлен",

View File

@ -197,7 +197,9 @@
},
"confirm": {
"delete": "您确定要删除此对话共享吗?这个操作不能撤销。"
}
},
"label": "管理页面分享",
"description": "启用或禁用页面分享功能。默认情况下,页面分享功能已启用。"
},
"notification": {
"pageShareSuccess": "对话共享服务 URL 已成功更新",

View File

@ -20,6 +20,7 @@ import { ShareBtn } from "~/components/Common/ShareBtn"
import { useTranslation } from "react-i18next"
import { OllamaIcon } from "../Icons/Ollama"
import { SelectedKnowledge } from "../Option/Knowledge/SelectedKnwledge"
import { useStorage } from "@plasmohq/storage/hook"
export default function OptionLayout({
children
@ -28,6 +29,7 @@ export default function OptionLayout({
}) {
const [sidebarOpen, setSidebarOpen] = useState(false)
const { t } = useTranslation(["option", "common"])
const [shareModeEnabled] = useStorage("shareMode", true)
const {
selectedModel,
@ -175,9 +177,10 @@ export default function OptionLayout({
<div className="flex flex-1 justify-end px-4">
<div className="ml-4 flex items-center md:ml-6">
<div className="flex gap-4 items-center">
{pathname === "/" && messages.length > 0 && !streaming && (
<ShareBtn messages={messages} />
)}
{pathname === "/" &&
messages.length > 0 &&
!streaming &&
shareModeEnabled && <ShareBtn messages={messages} />}
<Tooltip title={t("githubRepository")}>
<a
href="https://github.com/n4ze3m/page-assist"

View File

@ -1,15 +1,17 @@
import { useMutation, useQuery, useQueryClient } from "@tanstack/react-query"
import { Form, Input, Skeleton, Table, Tooltip, message } from "antd"
import { Form, Input, Skeleton, Switch, Table, Tooltip, message } from "antd"
import { Trash2 } from "lucide-react"
import { Trans, useTranslation } from "react-i18next"
import { SaveButton } from "~/components/Common/SaveButton"
import { deleteWebshare, getAllWebshares, getUserId } from "@/db"
import { getPageShareUrl, setPageShareUrl } from "~/services/ollama"
import { verifyPageShareURL } from "~/utils/verify-page-share"
import { useStorage } from "@plasmohq/storage/hook"
export const OptionShareBody = () => {
const queryClient = useQueryClient()
const { t } = useTranslation(["settings"])
const [shareModeEnabled, setShareModelEnabled] = useStorage("shareMode", true)
const { status, data } = useQuery({
queryKey: ["fetchShareInfo"],
@ -132,6 +134,20 @@ export const OptionShareBody = () => {
</div>
</Form.Item>
</Form>
<div className="space-y-2 flex mb-4 flex-row items-center justify-between rounded-lg dark:border-gray-600 ">
<div className="space-y-0.5">
<label className="text-sm font-semibold leading-5 text-gray-900 dark:text-white">
{t("manageShare.webshare.label")}
</label>
<p className="text-sm font-normal leading-5 text-gray-500 dark:text-gray-400">
{t("manageShare.webshare.description")}
</p>
</div>
<Switch
checked={shareModeEnabled}
onChange={setShareModelEnabled}
/>
</div>
</div>
<div>
<div>