Make the private repo checkbox flipped to be public, and now it’s default private

This commit is contained in:
Eric Allam
2023-02-20 21:17:48 +00:00
parent aca332fffc
commit 0a3b12d135
2 changed files with 16 additions and 16 deletions
@@ -1,6 +1,6 @@
import { FolderIcon } from "@heroicons/react/24/solid";
import { Form, useTransition } from "@remix-run/react";
import { ActionArgs, LoaderArgs } from "@remix-run/server-runtime";
import type { ActionArgs, LoaderArgs } from "@remix-run/server-runtime";
import {
redirect,
typedjson,
@@ -216,23 +216,23 @@ export default function AddTemplatePage() {
</InputGroup>
<div>
<p className="mb-1 text-sm text-slate-500">
Set the repo as private
Set the repo as public
</p>
<div className="flex w-full items-center rounded bg-black/20 px-3 py-2.5">
<Label
htmlFor="private"
className="flex cursor-pointer items-center gap-2 text-sm text-slate-300"
>
<Label
htmlFor="publicRepo"
className="flex cursor-pointer items-center gap-2 text-sm text-slate-300"
>
<div className="flex w-full items-center gap-2 rounded bg-black/20 px-3 py-2.5">
<input
type="checkbox"
name="private"
id="private"
name="publicRepo"
id="publicRepo"
className="border-3 h-4 w-4 cursor-pointer rounded border-black bg-slate-500 transition hover:bg-slate-300 focus:outline-none"
disabled={isSubmittingOrLoading}
/>
Private repo
</Label>
</div>
Public repo
</div>
</Label>
</div>
</div>
<div className="flex justify-end">
@@ -12,7 +12,7 @@ import { RefreshAppAuthorizationService } from "../github/refreshAppAuthorizatio
const FormSchema = z.object({
name: z.string().min(3).max(100),
templateId: z.string(),
private: z.literal("on").optional(),
publicRepo: z.literal("on").optional(),
appAuthorizationId: z.string(),
});
@@ -104,7 +104,7 @@ export class AddTemplateService {
id: data.templateId,
},
},
private: data.private === "on",
private: data.publicRepo !== "on",
organization: {
connect: {
slug: organizationSlug,
@@ -132,7 +132,7 @@ export class AddTemplateService {
return createUserRepository(
{
name: data.name,
private: data.private === "on",
private: data.publicRepo !== "on",
auto_init: true,
},
{
@@ -148,7 +148,7 @@ export class AddTemplateService {
{
org: authorization.accountName,
name: data.name,
private: data.private === "on",
private: data.publicRepo !== "on",
auto_init: true,
},
{