Skip to content

Commit

Permalink
Update navigation sub-tabs styling, Link component, ifnil function, g…
Browse files Browse the repository at this point in the history
…etLAFRegion function, IsCurrentServerMode function, index.css styling, Breadcrumbs component, package-lock.json, package.json, App.tsx, tsconfig.json, vite.config.ts, main.tsx, VerCompareUtils.test.tsx, CSS and TypeScript files, and .gitignore and app.ts in web2-spa and web2-server modules
  • Loading branch information
work7z committed Apr 25, 2024
1 parent de92a19 commit dad1ac2
Show file tree
Hide file tree
Showing 10 changed files with 41 additions and 44 deletions.
13 changes: 7 additions & 6 deletions .codeqlignore
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
# .codeqlignore

# ignore prettier

add-ons
add-ons/**
add-ons/**/*
add-ons/it-tools/\*\*/\*/_.vue
addons
addons/**
addons/**/*
*.vue
addons/it-tools/\*\*/\*/_.vue
addons/it-tools/src/App.vue
addons/it-tools/src/*.vue
modules/node/src/lib/prettier/**
modules/node/src/lib/prettier/\*
modules/web/src/lib/core
Expand Down
19 changes: 19 additions & 0 deletions modules/web2-spa/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion modules/web2-spa/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -263,11 +263,12 @@
"undefined": "^0.1.0",
"vite": "^5.1.6",
"vite-bundle-visualizer": "^1.0.0",
"vite-plugin-dynamic-import": "^1.5.0",
"vite-plugin-top-level-await": "^1.4.1",
"vite-plugin-wasm": "^3.3.0",
"vitest": "^1.2.2",
"webpack-dev-server": "4.6.0",
"webpack-manifest-plugin": "4.0.2",
"workbox-webpack-plugin": "7.0.0"
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,8 @@ import { ifnil } from "@/__CORE__/meta/fn";
import { getToolSubCategory } from "@/[lang]/client/src/impl/tools/d_subcategory";
export type AuthInfoProps = { authInfo: AuthInfo }
export type CombindSearchProps = PageProps<any, any>

import "@blueprintjs/core/lib/css/blueprint.css";
import "@blueprintjs/icons/lib/css/blueprint-icons.css";

export default function Home(props: CategorySearchProps) {
let { subCategory, category } = props.params
Expand Down
2 changes: 1 addition & 1 deletion modules/web2-spa/src/[lang]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import _, { random } from "lodash";

import React, { } from "react";
import { PageProps, PortalDefinitionType, TopMainCategoryNavList } from '@/__CORE__/meta/pages'
import { Dot, getXSubPath, isChineseByXLocal } from "../__CORE__/utils/TranslationUtils";
import { Dot, isChineseByXLocal } from "../__CORE__/utils/TranslationUtils";
import Link from "@/__CORE__/components/Link";

import { getAppDevIcon, getAppKeywords } from "../__CORE__/config/imgconfig";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,13 +48,12 @@ import {
import React, { useEffect, useState } from "react";
import _ from "lodash";
import { CSS_TEXT_ANCHOR_CSS } from "@/__CORE__/meta/styles";
import { Dot, getXSubPath } from "../../utils/TranslationUtils";
import { Dot, } from "../../utils/TranslationUtils";
import { fn_Geti18n } from "@/[lang]/client/src/i18n-pure";

interface PassProp { }
export default (props: PassProp): any => {
let i18n = fn_Geti18n(Dot)
let splitArr = getXSubPath().split("/").filter(x => x) // // location.pathname.split("/")
return <div>
<div className='bp5-text-muted space-x-2 '>
{i18n?.map(x => {
Expand Down
31 changes: 5 additions & 26 deletions modules/web2-spa/src/__CORE__/utils/TranslationUtils.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import Qs from 'query-string'
import { LANG_EN_US, LangDefinition } from "../meta/constants";
import { LocaleType, all_locales as all_locales, zhCNLocale } from '@/middleware';
import { isDevEnv } from '../share-spa/env4vite';
import { sysLocale } from "./cTranslationUtils";

let VER_FORGE_FORM = '0.0.1'
export const KEY_LANG_PACK_ZH_CN = "KEY_LANG_PACK_ZH_CN" + VER_FORGE_FORM;
Expand Down Expand Up @@ -57,12 +58,7 @@ function formatResultWithReplacer(val = "", ...args) {


export let getXLocaleStrInRSC = (): LocaleType => {
// const headersList = headers();
// const val = headersList.get('x-locale') || "";
// let item = all_locales.find(x => x.langInHttp == val)
// return item || zhCNLocale
// TODO: handle this
return zhCNLocale
return sysLocale
}

export let isChineseByXLocal = (): boolean => {
Expand All @@ -79,31 +75,14 @@ export let headers = () => {
}

export let getXHostname = (): string => {
const headersList = headers();
const val = headersList.get('x-hostname') || "";
return val;
return location.hostname;
}
export let getHStr = (): string => {
const headersList = headers();
const val = headersList.get('x-hstr') || "";
return val;
return ''
}
export let getXSearchParams = (): { [key: string]: any } => {
const headersList = headers();
const val = headersList.get('x-search') || "";
return Qs.parse(val);
}
export let getXNonCNUsers = (): boolean => {
const headersList = headers();
const val = headersList.get('x-noncn') || "";
return val == 'true';
return Qs.parse(location.search);
}
export let getXSubPath = (): string => {
const headersList = headers();
const val = headersList.get('x-path') || "";
return val;
}


export let getWebsiteLocale = () => {
let xlocale = getXLocaleStrInRSC()
Expand Down
1 change: 0 additions & 1 deletion modules/web2-spa/src/__CORE__/utils/cTranslationUtils.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ if (typeof window !== "undefined") {
sysLocale = all_locales.find(x => x.langInHttp == sysLang) || sysLocale
}


interface LangMap {
zh_CN: LangDefinition;
zh_HK: LangDefinition;
Expand Down
7 changes: 2 additions & 5 deletions modules/web2-spa/src/__CORE__/utils/routeUtils.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,13 @@
// Copyright (C) 2024 - Present, https://laftools.dev and https://codegen.cc


// let xlocale = getXLocaleStrInRSC()

import { LocaleType } from "@/middleware"
import { getXLocaleStrInRSC } from "./TranslationUtils"
import _ from 'lodash'
import { sysLocale } from "./cTranslationUtils"

export let getLocalePrefix_Server = (): LocaleType => {
return getXLocaleStrInRSC()
}
export let fmtURL_Server = (str: string[]): string => {
let localePrefix = getLocalePrefix_Server().langInURL
let localePrefix = sysLocale.langInURL
return '/' + ([localePrefix, ...str].filter(x => x != '' && !_.isNil(x)).join('/'))
}
3 changes: 2 additions & 1 deletion modules/web2-spa/vite.config.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { defineConfig } from "vite";
import react from "@vitejs/plugin-react";
import dynamicImport from "vite-plugin-dynamic-import";
import tailwindcss from "tailwindcss";
import autoprefixer from "autoprefixer";
import path from "path";
Expand All @@ -11,7 +12,7 @@ const builtinsPlugin = {
};
// https://vitejs.dev/config/
export default defineConfig({
plugins: [react(), builtinsPlugin],
plugins: [react(), builtinsPlugin, dynamicImport(/* options */)],

css: {
postcss: {
Expand Down

0 comments on commit dad1ac2

Please sign in to comment.