Skip to content

Commit

Permalink
fix: desktop right-click menu issue (#4939)
Browse files Browse the repository at this point in the history
* fix: desktop right-click menu issue

* update self-hosting

* update

* add i18n

* update bd_vid
  • Loading branch information
zjy365 authored Aug 2, 2024
1 parent c544506 commit ce47655
Show file tree
Hide file tree
Showing 6 changed files with 30 additions and 7 deletions.
8 changes: 7 additions & 1 deletion docs/website/src/pages/self-hosting/index.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { PC_MIN_WIDTH } from '@site/src/constants/platform';
import useWindow from '@site/src/hooks/useWindow';
import React, { useMemo } from 'react';
import React, { useEffect, useMemo } from 'react';
import Footer from '../components/Footer';
import Header from './header';
import './index.scss';
Expand All @@ -14,6 +14,12 @@ export default function Pricing() {
const { screenWidth } = useWindow();
const isPc = useMemo(() => screenWidth > PC_MIN_WIDTH, [screenWidth]);

useEffect(() => {
const urlParams = new URLSearchParams(window.location.search);
const value = urlParams.get('bd_vid');
sessionStorage.setItem('bd_vid', value);
}, []);

return (
<div id="sealos-layout-wrap-home-page">
<Layout>
Expand Down
2 changes: 1 addition & 1 deletion frontend/desktop/src/api/platform.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import { AccountCRD } from '@/types/user';

// handle baidu
export const uploadConvertData = (newType: number[], url?: string) => {
const defaultUrl = 'https://sealos.run/';
const defaultUrl = 'https://sealos.run/self-hosting';
const main_url = url || defaultUrl;
const bd_vid = sessionStorage.getItem('bd_vid');
if (!bd_vid) {
Expand Down
1 change: 1 addition & 0 deletions frontend/desktop/src/components/AppDock/index.module.css
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
top: 0;
left: 0;
min-width: 140px;
position: absolute;
}

.arrow {
Expand Down
3 changes: 1 addition & 2 deletions frontend/desktop/src/pages/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,7 @@ import { useRouter } from 'next/router';
import Script from 'next/script';
import { createContext, useEffect, useState } from 'react';
import useCallbackStore from '@/stores/callback';
import FloatButton from '@/components/floating_button';
// import 'react-contexify/dist/ReactContexify.css';
import 'react-contexify/dist/ReactContexify.css';

const destination = '/signin';
interface IMoreAppsContext {
Expand Down
20 changes: 17 additions & 3 deletions frontend/desktop/src/types/i18next.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,23 @@ export interface I18nNamespaces {

export type I18nNsType = (keyof I18nNamespaces)[];

export type I18nCommonKey = keyof I18nNamespaces['common'];
export type I18nCloudProvidersKey = keyof I18nNamespaces['cloudProviders'];
export type I18nErrorKey = keyof I18nNamespaces['error'];
export type I18nCommonKey = NestedKeyOf<I18nNamespaces>['common'];
export type I18nCloudProvidersKey = NestedKeyOf<I18nNamespaces>['cloudProviders'];
export type I18nErrorKey = NestedKeyOf<I18nNamespaces>['error'];

export type NestedKeyOf<ObjectType extends object> = {
[Key in keyof ObjectType & (string | number)]: ObjectType[Key] extends object
? `${Key}.${NestedKeyOf<ObjectType[Key]>}`
: `${Key}`;
}[keyof ObjectType & (string | number)];

export type ParseKeys<Ns extends keyof I18nNamespaces = keyof I18nNamespaces> = {
[K in Ns]: `${K}:${NestedKeyOf<I18nNamespaces[K]>}`;
}[Ns];

export type I18nKeyFunction = {
<Key extends ParseKeys>(key: Key): Key;
};

declare module 'i18next' {
interface CustomTypeOptions {
Expand Down
3 changes: 3 additions & 0 deletions frontend/desktop/src/utils/i18n.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import { I18nKeyFunction } from '../types/i18next';

export const i18nT: I18nKeyFunction = (key) => key;

0 comments on commit ce47655

Please sign in to comment.