mirror of
https://github.com/simstudioai/sim.git
synced 2026-01-09 15:07:55 -05:00
fix(settings): added isHosted gate to access homepage from settings, fixed context menu options (#2694)
* fix(settings): added isHosted gate to access homepage from settings, fixed context menu options * stronger typing
This commit is contained in:
@@ -29,7 +29,7 @@ export async function POST(
|
|||||||
|
|
||||||
const workflow = access.workflow
|
const workflow = access.workflow
|
||||||
|
|
||||||
let payload: any = {}
|
let payload: Record<string, unknown> = {}
|
||||||
try {
|
try {
|
||||||
payload = await request.json()
|
payload = await request.json()
|
||||||
} catch {
|
} catch {
|
||||||
|
|||||||
@@ -158,7 +158,11 @@ export function ChunkContextMenu({
|
|||||||
)}
|
)}
|
||||||
|
|
||||||
{/* Destructive action */}
|
{/* Destructive action */}
|
||||||
{onToggleEnabled && onDelete && <PopoverDivider />}
|
{onDelete &&
|
||||||
|
((!isMultiSelect && onOpenInNewTab) ||
|
||||||
|
(!isMultiSelect && onEdit) ||
|
||||||
|
(!isMultiSelect && onCopyContent) ||
|
||||||
|
onToggleEnabled) && <PopoverDivider />}
|
||||||
{onDelete && (
|
{onDelete && (
|
||||||
<PopoverItem
|
<PopoverItem
|
||||||
disabled={disableDelete}
|
disabled={disableDelete}
|
||||||
|
|||||||
@@ -163,7 +163,11 @@ export function DocumentContextMenu({
|
|||||||
)}
|
)}
|
||||||
|
|
||||||
{/* Destructive action */}
|
{/* Destructive action */}
|
||||||
{onToggleEnabled && onDelete && <PopoverDivider />}
|
{onDelete &&
|
||||||
|
((!isMultiSelect && onOpenInNewTab) ||
|
||||||
|
(!isMultiSelect && onRename) ||
|
||||||
|
(!isMultiSelect && hasTags && onViewTags) ||
|
||||||
|
onToggleEnabled) && <PopoverDivider />}
|
||||||
{onDelete && (
|
{onDelete && (
|
||||||
<PopoverItem
|
<PopoverItem
|
||||||
disabled={disableDelete}
|
disabled={disableDelete}
|
||||||
|
|||||||
@@ -160,7 +160,12 @@ export function KnowledgeBaseContextMenu({
|
|||||||
)}
|
)}
|
||||||
|
|
||||||
{/* Destructive action */}
|
{/* Destructive action */}
|
||||||
{showEdit && onEdit && showDelete && onDelete && <PopoverDivider />}
|
{showDelete &&
|
||||||
|
onDelete &&
|
||||||
|
((showOpenInNewTab && onOpenInNewTab) ||
|
||||||
|
(showViewTags && onViewTags) ||
|
||||||
|
onCopyId ||
|
||||||
|
(showEdit && onEdit)) && <PopoverDivider />}
|
||||||
{showDelete && onDelete && (
|
{showDelete && onDelete && (
|
||||||
<PopoverItem
|
<PopoverItem
|
||||||
disabled={disableDelete}
|
disabled={disableDelete}
|
||||||
|
|||||||
@@ -21,6 +21,7 @@ import { signOut, useSession } from '@/lib/auth/auth-client'
|
|||||||
import { ANONYMOUS_USER_ID } from '@/lib/auth/constants'
|
import { ANONYMOUS_USER_ID } from '@/lib/auth/constants'
|
||||||
import { useBrandConfig } from '@/lib/branding/branding'
|
import { useBrandConfig } from '@/lib/branding/branding'
|
||||||
import { getEnv, isTruthy } from '@/lib/core/config/env'
|
import { getEnv, isTruthy } from '@/lib/core/config/env'
|
||||||
|
import { isHosted } from '@/lib/core/config/feature-flags'
|
||||||
import { getBaseUrl } from '@/lib/core/utils/urls'
|
import { getBaseUrl } from '@/lib/core/utils/urls'
|
||||||
import { useProfilePictureUpload } from '@/app/workspace/[workspaceId]/w/components/sidebar/components/settings-modal/hooks/use-profile-picture-upload'
|
import { useProfilePictureUpload } from '@/app/workspace/[workspaceId]/w/components/sidebar/components/settings-modal/hooks/use-profile-picture-upload'
|
||||||
import { useGeneralSettings, useUpdateGeneralSetting } from '@/hooks/queries/general-settings'
|
import { useGeneralSettings, useUpdateGeneralSetting } from '@/hooks/queries/general-settings'
|
||||||
@@ -565,13 +566,15 @@ export function General({ onOpenChange }: GeneralProps) {
|
|||||||
</Button>
|
</Button>
|
||||||
</>
|
</>
|
||||||
)}
|
)}
|
||||||
<Button
|
{isHosted && (
|
||||||
onClick={() => window.open('/?from=settings', '_blank', 'noopener,noreferrer')}
|
<Button
|
||||||
variant='active'
|
onClick={() => window.open('/?from=settings', '_blank', 'noopener,noreferrer')}
|
||||||
className='ml-auto'
|
variant='active'
|
||||||
>
|
className='ml-auto'
|
||||||
Home Page
|
>
|
||||||
</Button>
|
Home Page
|
||||||
|
</Button>
|
||||||
|
)}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{/* Password Reset Confirmation Modal */}
|
{/* Password Reset Confirmation Modal */}
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ export interface RequestParams {
|
|||||||
url: string
|
url: string
|
||||||
method?: HttpMethod
|
method?: HttpMethod
|
||||||
headers?: TableRow[]
|
headers?: TableRow[]
|
||||||
body?: any
|
body?: unknown
|
||||||
params?: TableRow[]
|
params?: TableRow[]
|
||||||
pathParams?: Record<string, string>
|
pathParams?: Record<string, string>
|
||||||
formData?: Record<string, string | Blob>
|
formData?: Record<string, string | Blob>
|
||||||
@@ -12,7 +12,7 @@ export interface RequestParams {
|
|||||||
|
|
||||||
export interface RequestResponse extends ToolResponse {
|
export interface RequestResponse extends ToolResponse {
|
||||||
output: {
|
output: {
|
||||||
data: any
|
data: unknown
|
||||||
status: number
|
status: number
|
||||||
headers: Record<string, string>
|
headers: Record<string, string>
|
||||||
}
|
}
|
||||||
@@ -20,7 +20,7 @@ export interface RequestResponse extends ToolResponse {
|
|||||||
|
|
||||||
export interface WebhookRequestParams {
|
export interface WebhookRequestParams {
|
||||||
url: string
|
url: string
|
||||||
body?: any
|
body?: unknown
|
||||||
secret?: string
|
secret?: string
|
||||||
headers?: Record<string, string>
|
headers?: Record<string, string>
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user