这是indexloc提供的服务,不要输入任何密码
Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@ import { useState } from "react";
import {
formatDate,
getFileExtension,
truncate,
} from "../../../../../../utils/directories";
middleTruncate,
} from "@/utils/directories";
import { File, Trash } from "@phosphor-icons/react";
import System from "../../../../../../models/system";
import System from "@/models/system";
import debounce from "lodash.debounce";

export default function FileRow({
Expand Down Expand Up @@ -76,7 +76,7 @@ export default function FileRow({
onMouseLeave={handleMouseLeave}
>
<p className="whitespace-nowrap overflow-hidden">
{truncate(item.title, 17)}
{middleTruncate(item.title, 17)}
</p>
{showTooltip && (
<div className="absolute left-0 bg-white text-black p-1.5 rounded shadow-lg whitespace-nowrap">
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { useState } from "react";
import FileRow from "../FileRow";
import { CaretDown, FolderNotch } from "@phosphor-icons/react";
import { truncate } from "../../../../../../utils/directories";
import { middleTruncate } from "@/utils/directories";

export default function FolderRow({
item,
Expand Down Expand Up @@ -50,7 +50,7 @@ export default function FolderRow({
weight="fill"
/>
<p className="whitespace-nowrap overflow-show">
{truncate(item.name, 40)}
{middleTruncate(item.name, 40)}
</p>
</div>
<p className="col-span-2 pl-3.5" />
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
import UploadFile from "../UploadFile";
import PreLoader from "../../../../Preloader";
import PreLoader from "@/components/Preloader";
import { useEffect, useState } from "react";
import FolderRow from "./FolderRow";
import pluralize from "pluralize";
import Workspace from "../../../../../models/workspace";

export default function Directory({
files,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@ import { useState } from "react";
import {
formatDate,
getFileExtension,
truncate,
} from "../../../../../../utils/directories";
middleTruncate,
} from "@/utils/directories";
import { ArrowUUpLeft, File } from "@phosphor-icons/react";
import Workspace from "../../../../../../models/workspace";
import Workspace from "@/models/workspace";
import debounce from "lodash.debounce";

export default function WorkspaceFileRow({
Expand Down Expand Up @@ -65,7 +65,7 @@ export default function WorkspaceFileRow({
onMouseLeave={handleMouseLeave}
>
<p className="whitespace-nowrap overflow-hidden">
{truncate(item.title, 17)}
{middleTruncate(item.title, 17)}
</p>
{showTooltip && (
<div className="absolute left-0 bg-white text-black p-1.5 rounded shadow-lg whitespace-nowrap">
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import PreLoader from "../../../../Preloader";
import { dollarFormat } from "../../../../../utils/numbers";
import PreLoader from "@/components/Preloader";
import { dollarFormat } from "@/utils/numbers";
import WorkspaceFileRow from "./WorkspaceFileRow";

export default function WorkspaceDirectory({
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/utils/directories.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ export function getFileExtension(path) {
return path?.split(".")?.slice(-1)?.[0] || "file";
}

export function truncate(str, n) {
export function middleTruncate(str, n) {
const fileExtensionPattern = /(\..+)$/;
const extensionMatch = str.match(fileExtensionPattern);

Expand Down