Skip to content

Commit

Permalink
comment
Browse files Browse the repository at this point in the history
  • Loading branch information
xXAvoraXx committed Jul 7, 2024
1 parent 662addf commit a9b1c1b
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 12 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "umi-plugin-ssr-routes",
"author": "xXAvoraXx",
"version": "1.0.9",
"version": "1.0.10",
"main": "dist/cjs/index.js",
"types": "dist/cjs/index.d.ts",
"scripts": {
Expand Down
18 changes: 9 additions & 9 deletions src/utils/getSessionContent.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,40 +15,40 @@ export function setRemoteMenu(data: RouteRaw[]) {
}
function generateComponentPath(inputPath: string): string {
// Başındaki './' kısmını kaldır
// Remove the './' at the beginning
let newPath = inputPath.replace(/^\\.\\//, '');
// Slash karakterlerini işle
// Process slash characters
const pathSegments = newPath.split('/');
newPath = pathSegments
.map((segment, index) => {
// İlk segmentin sonuna "pages" ekleme
// Add "pages" at the end of the first segment
if (index === 0) {
return segment;
}
// Diğer segmentlerin sonuna "pages" ekle
// Add "pages" at the end of other segments
return 'pages/' + segment;
})
.join('/');
// Sonuna '/index' ekle
// Add '/index' at the end
newPath = newPath + '/index';
return newPath;
}
// component özelliğini eleman özelliğine çeviren fonksiyon
// Function to convert component property to element property
function generateComponent(component: string | undefined): React.ReactNode | null {
// component değeri varsa dönüş yapın, yoksa null döndürün
// Return if component exists, otherwise return null
if (component) {
const componentPath = generateComponentPath(component);
// Bileşeni oluştur ve sakla
// Create and store the component
return React.createElement(LazyLoadable(lazy(() => import(\`@/pages/\${componentPath}\`))));
}
return React.createElement(EmptyRouteOutlet);
}
// Sunucudan gelen RouteRaw dizisini Route dizisine dönüştürün
// Convert RouteRaw array from server to Route array
function convertRoutes(rawRoutes: RouteRaw[]): Route[] {
return rawRoutes.map((rawRoute) => {
const { component, routes, ...rest } = rawRoute;
Expand Down
4 changes: 2 additions & 2 deletions src/utils/getTypeContent.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ interface RouteObject {
element?: React.ReactNode | null;
}
// Ön tarafta sunucudan gelen verilere dayalı olarak oluşturulan rota verisi
// Route data generated on the front end based on data from the server.
interface Route extends RouteObject {
id: string;
path: string;
Expand Down Expand Up @@ -32,7 +32,7 @@ interface Route extends RouteObject {
[key: string]: any;
}
// Sunucudan gelen rota verisi RouteRaw[] olarak olur
// Route data from the server will be RouteRaw[]
interface RouteRaw extends Route {
key?: string;
parentKeys?: 'ant-design-pro-layout' | string[];
Expand Down

0 comments on commit a9b1c1b

Please sign in to comment.