Skip to content

Commit

Permalink
feat: support edit repo's description
Browse files Browse the repository at this point in the history
  • Loading branch information
AaronConlon committed Jul 20, 2024
1 parent 8260890 commit fb2fc8d
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 4,899 deletions.
32 changes: 30 additions & 2 deletions apps/v-next/components/query/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,7 @@ export default function Query({ accessToken }: IQueryProps) {
<Link
href={html_url}
target="_blank"
className="flex gap-1 min-w-[200px] items-center"
className="flex gap-1 min-w-[120px] items-center"
>
<span>{name}</span>
{fork && (
Expand Down Expand Up @@ -286,7 +286,35 @@ export default function Query({ accessToken }: IQueryProps) {
}}
/>
</Table.Td>
<Table.Td className="hidden md:table-cell">{description || '-'}</Table.Td>
<Table.Td className="hidden md:table-cell">
<textarea
className="block w-full border-none bg-transparent outline-none resize-none"
defaultValue={description}
onBlur={(e) => {
const { value } = e.target;
if (value !== description) {
GithubAPI.repo
.patchRepo({
auth: accessToken,
repo: name,
owner: owner.login,
schema: {
description: value
}
})
.then(() => {
toast.success('Change the repository description successfully');
refresh();
})
.catch((error) => {
// error info
console.error(error);
toast.error('Failed to change the repository description');
});
}
}}
/>
</Table.Td>
<Table.Td className="hidden md:table-cell">{stargazers_count}</Table.Td>
<Table.Td className="hidden md:table-cell">{forks_count}</Table.Td>
<Table.Td className="hidden md:table-cell">
Expand Down
Loading

0 comments on commit fb2fc8d

Please sign in to comment.