Skip to content

Commit

Permalink
Alignment (#1141)
Browse files Browse the repository at this point in the history
Co-authored-by: ukrocks007 <ukrocks.mehta@gmail.com>
  • Loading branch information
deepakprabhakara and ukrocks007 authored Mar 19, 2024
1 parent fe2c026 commit 1245eea
Show file tree
Hide file tree
Showing 6 changed files with 33 additions and 13 deletions.
2 changes: 1 addition & 1 deletion check-locale.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ const exceptionList = [
'invalid-credentials',
'no-credentials',
'token-not-found',
]
];

const allStrings = {};

Expand Down
10 changes: 2 additions & 8 deletions components/apiKey/APIKeys.tsx
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
import { EmptyState, WithLoadingAndError } from '@/components/shared';
import ConfirmationDialog from '@/components/shared/ConfirmationDialog';
import fetcher from '@/lib/fetcher';
import type { ApiKey, Team } from '@prisma/client';
import { useTranslation } from 'next-i18next';
import { useState } from 'react';
import { Button } from 'react-daisyui';
import { toast } from 'react-hot-toast';
import useSWR from 'swr';
import type { ApiResponse } from 'types';
import NewAPIKey from './NewAPIKey';
import useAPIKeys from 'hooks/useAPIKeys';
import { Table } from '@/components/shared/table/Table';

interface APIKeysProps {
Expand All @@ -17,17 +16,12 @@ interface APIKeysProps {

const APIKeys = ({ team }: APIKeysProps) => {
const { t } = useTranslation('common');
const { data, isLoading, error, mutate } = useAPIKeys(team.slug);
const [selectedApiKey, setSelectedApiKey] = useState<ApiKey | null>(null);
const [createModalVisible, setCreateModalVisible] = useState(false);
const [confirmationDialogVisible, setConfirmationDialogVisible] =
useState(false);

// Fetch API Keys
const { data, isLoading, error, mutate } = useSWR<{ data: ApiKey[] }>(
`/api/teams/${team.slug}/api-keys`,
fetcher
);

// Delete API Key
const deleteApiKey = async (apiKey: ApiKey | null) => {
if (!apiKey) return;
Expand Down
3 changes: 2 additions & 1 deletion components/shared/Badge.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import classNames from 'classnames';
import { BadgeProps, Badge as BaseBadge } from 'react-daisyui';

const Badge = (props: BadgeProps) => {
Expand All @@ -7,7 +8,7 @@ const Badge = (props: BadgeProps) => {
<>
<BaseBadge
{...props}
className={`rounded text-xs py-2 text-white ${className}`}
className={classNames('rounded text-xs py-2 text-white', className)}
>
{children}
</BaseBadge>
Expand Down
4 changes: 2 additions & 2 deletions components/shared/InputWithCopyButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@ const InputWithCopyButton = (props: InputWithCopyButtonProps) => {
<CopyToClipboardButton value={value?.toString() || ''} />
</div>
<Input
className="input input-bordered w-full"
className="input input-bordered w-full text-sm"
{...rest}
defaultValue={value}
value={value}
/>
{description && (
<label className="label">
Expand Down
2 changes: 1 addition & 1 deletion components/shared/shell/NavigationItems.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ const NavigationItem = ({ menu, className }: NavigationItemProps) => {
href={menu.href}
className={`flex items-center rounded text-sm text-gray-900 hover:bg-gray-100 px-2 p-2 gap-2 hover:dark:text-black ${
menu.active ? 'bg-gray-100 font-semibold' : ''
}${className}`}
} ${className}`}
>
{menu.icon && (
<menu.icon
Expand Down
25 changes: 25 additions & 0 deletions hooks/useAPIKeys.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import fetcher from '@/lib/fetcher';
import { ApiKey } from '@prisma/client';
import useSWR, { mutate } from 'swr';
import type { ApiResponse } from 'types';

const useAPIKeys = (slug: string | undefined) => {
const url = `/api/teams/${slug}/api-keys`;

const { data, error, isLoading } = useSWR<ApiResponse<ApiKey[]>>(() => {
return slug ? url : null;
}, fetcher);

const mutateAPIKeys = async () => {
mutate(url);
};

return {
data,
isLoading,
error,
mutate: mutateAPIKeys,
};
};

export default useAPIKeys;

0 comments on commit 1245eea

Please sign in to comment.