mirror of
https://github.com/aykhans/slash-e.git
synced 2025-07-03 12:17:55 +00:00
feat: add workspace security setting definition
This commit is contained in:
@ -35,10 +35,10 @@ const Header: React.FC = () => {
|
||||
<Logo className="mr-2" />
|
||||
Slash
|
||||
</Link>
|
||||
{[PlanType.PRO, PlanType.ENTERPRISE].includes(profile.plan) && (
|
||||
{profile.subscription?.plan && [PlanType.PRO, PlanType.ENTERPRISE].includes(profile.subscription.plan) && (
|
||||
<span className="ml-1 text-xs px-1.5 leading-5 border rounded-full bg-blue-600 border-blue-700 text-white shadow dark:opacity-70">
|
||||
{/* PRO or ENT */}
|
||||
{profile.plan.substring(0, 3)}
|
||||
{profile.subscription.plan.substring(0, 3)}
|
||||
</span>
|
||||
)}
|
||||
{shouldShowRouterSwitch && (
|
||||
|
@ -9,7 +9,7 @@ interface Props {
|
||||
|
||||
const Logo = ({ className }: Props) => {
|
||||
const workspaceStore = useWorkspaceStore();
|
||||
const hasCustomBranding = workspaceStore.profile.plan === PlanType.PRO;
|
||||
const hasCustomBranding = workspaceStore.profile.subscription?.plan === PlanType.PRO;
|
||||
const branding = hasCustomBranding && workspaceStore.setting.branding ? new TextDecoder().decode(workspaceStore.setting.branding) : "";
|
||||
return (
|
||||
<div className={classNames("w-8 h-auto dark:text-gray-500 rounded-lg overflow-hidden", className)}>
|
||||
|
@ -35,7 +35,7 @@ const WorkspaceSection = () => {
|
||||
const [workspaceSetting, setWorkspaceSetting] = useState<WorkspaceSetting>(workspaceStore.setting);
|
||||
const originalWorkspaceSetting = useRef<WorkspaceSetting>(workspaceStore.setting);
|
||||
const allowSave = !isEqual(originalWorkspaceSetting.current, workspaceSetting);
|
||||
const hasCustomBranding = workspaceStore.profile.plan === PlanType.PRO;
|
||||
const hasCustomBranding = workspaceStore.profile.subscription?.plan === PlanType.PRO;
|
||||
const branding = hasCustomBranding && workspaceSetting.branding ? new TextDecoder().decode(workspaceSetting.branding) : "";
|
||||
|
||||
const onBrandingChange = async (event: React.ChangeEvent<HTMLInputElement>) => {
|
||||
@ -80,12 +80,10 @@ const WorkspaceSection = () => {
|
||||
}
|
||||
|
||||
try {
|
||||
const setting = (
|
||||
await workspaceServiceClient.updateWorkspaceSetting({
|
||||
setting: workspaceSetting,
|
||||
updateMask: updateMask,
|
||||
})
|
||||
).setting as WorkspaceSetting;
|
||||
const setting = await workspaceServiceClient.updateWorkspaceSetting({
|
||||
setting: workspaceSetting,
|
||||
updateMask: updateMask,
|
||||
});
|
||||
setWorkspaceSetting(setting);
|
||||
await workspaceStore.fetchWorkspaceSetting();
|
||||
originalWorkspaceSetting.current = setting;
|
||||
|
Reference in New Issue
Block a user