2025-06-28 00:38:09 +02:00
|
|
|
import type { Script } from "@/lib/types";
|
|
|
|
|
|
2024-11-04 23:55:08 +01:00
|
|
|
import { Separator } from "@/components/ui/separator";
|
2025-06-28 00:38:09 +02:00
|
|
|
import handleCopy from "@/components/handle-copy";
|
|
|
|
|
import { Button } from "@/components/ui/button";
|
2024-11-04 23:55:08 +01:00
|
|
|
|
|
|
|
|
export default function DefaultPassword({ item }: { item: Script }) {
|
2024-11-19 22:21:00 +01:00
|
|
|
const { username, password } = item.default_credentials;
|
2025-06-02 02:56:23 -05:00
|
|
|
const hasDefaultLogin = username || password;
|
2024-11-19 22:21:00 +01:00
|
|
|
|
2025-06-28 00:38:09 +02:00
|
|
|
if (!hasDefaultLogin)
|
|
|
|
|
return null;
|
2024-11-19 22:21:00 +01:00
|
|
|
|
|
|
|
|
const copyCredential = (type: "username" | "password") => {
|
|
|
|
|
handleCopy(type, item.default_credentials[type] ?? "");
|
|
|
|
|
};
|
2024-11-04 23:55:08 +01:00
|
|
|
|
|
|
|
|
return (
|
Refactor ScriptItem and Buttons components to enhance layout and integrate dropdown for links. Update InterFaces component for improved styling and structure. (#3567)
* Refactor ScriptItem and Buttons components to enhance layout and integrate dropdown for links. Update InterFaces component for improved styling and structure.
* Add React Query integration and enhance component structure
- Introduced `@tanstack/react-query` for data fetching and state management.
- Added `QueryProvider` component to wrap the application with QueryClient.
- Refactored `ScriptItem` to utilize `useVersions` hook for fetching versions.
- Created `ResourceDisplay` and `VersionBadge` components for better resource representation.
- Improved layout and styling across various components, including `Alerts`, `Buttons`, and `DefaultPassword`.
- Updated `layout.tsx` to include the new `QueryProvider` for global state management.
* Remove bun.lock file to streamline dependency management and prevent potential conflicts.
* Update dependencies in package.json and package-lock.json
- Removed `@vercel/analytics` from dependencies.
- Upgraded `vitest` and related packages to version `3.1.1`.
- Updated various packages to their latest versions for improved performance and compatibility.
- Adjusted Node.js engine requirements to support newer versions.
* Update dependencies in package.json and package-lock.json
- Upgraded various Radix UI components to their latest versions for improved functionality and performance.
- Updated `chart.js`, `class-variance-authority`, `cmdk`, `framer-motion`, `fuse.js`, `nuqs`, `pocketbase`, and other packages to their latest versions.
- Enhanced TypeScript and ESLint packages for better type checking and linting capabilities.
- Updated Tailwind CSS and related plugins for improved styling and utility classes.
- Adjusted Node.js engine requirements in several packages to support newer versions.
2025-04-01 15:38:57 +02:00
|
|
|
<div className="mt-4 rounded-lg border shadow-sm">
|
|
|
|
|
<div className="flex gap-3 px-4 py-2 bg-accent/25">
|
2024-11-19 22:21:00 +01:00
|
|
|
<h2 className="text-lg font-semibold">Default Login Credentials</h2>
|
|
|
|
|
</div>
|
|
|
|
|
<Separator className="w-full" />
|
|
|
|
|
<div className="flex flex-col gap-2 p-4">
|
|
|
|
|
<p className="mb-2 text-sm">
|
2025-06-28 00:38:09 +02:00
|
|
|
You can use the following credentials to login to the
|
|
|
|
|
{" "}
|
|
|
|
|
{item.name}
|
|
|
|
|
{" "}
|
|
|
|
|
{item.type}
|
|
|
|
|
.
|
2024-11-19 22:21:00 +01:00
|
|
|
</p>
|
2025-06-02 02:56:23 -05:00
|
|
|
{["username", "password"].map((type) => {
|
|
|
|
|
const value = item.default_credentials[type as "username" | "password"];
|
2025-06-28 00:38:09 +02:00
|
|
|
return value && value.trim() !== ""
|
|
|
|
|
? (
|
|
|
|
|
<div key={type} className="text-sm">
|
|
|
|
|
{type.charAt(0).toUpperCase() + type.slice(1)}
|
|
|
|
|
:
|
|
|
|
|
{" "}
|
|
|
|
|
<Button variant="secondary" size="null" onClick={() => copyCredential(type as "username" | "password")}>
|
|
|
|
|
{value}
|
|
|
|
|
</Button>
|
|
|
|
|
</div>
|
|
|
|
|
)
|
|
|
|
|
: null;
|
2025-06-02 02:56:23 -05:00
|
|
|
})}
|
2024-11-19 22:21:00 +01:00
|
|
|
</div>
|
2024-11-04 23:55:08 +01:00
|
|
|
</div>
|
|
|
|
|
);
|
|
|
|
|
}
|