Skip to content

Commit

Permalink
chore: remove deprecated onClick
Browse files Browse the repository at this point in the history
  • Loading branch information
casperiv0 committed Oct 2, 2023
1 parent 53aad04 commit b419553
Show file tree
Hide file tree
Showing 17 changed files with 19 additions and 27 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ export function PruneUnitsModal() {

<footer>
<Button
onClick={handleSubmit}
onPress={handleSubmit}
type="button"
className="mt-4"
isDisabled={asyncTable.isLoading || state === "loading"}
Expand Down
10 changes: 1 addition & 9 deletions apps/client/src/components/auth/api-verification.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { GetCADSettingsData } from "@snailycad/types/api";
import { Alert, Button } from "@snailycad/ui";
import { Alert } from "@snailycad/ui";
import { getAPIUrl } from "@snailycad/utils/api-url";
import { useQuery } from "@tanstack/react-query";
import useFetch from "lib/useFetch";
Expand Down Expand Up @@ -36,10 +36,6 @@ export function ApiVerification(props: Props) {
},
});

function handleCopyError(error: any) {
navigator.clipboard.writeText(error);
}

if (error && props.isCORSError) {
return (
<div className="fixed inset-0 grid place-content-center z-[999] text-white bg-primary">
Expand Down Expand Up @@ -145,10 +141,6 @@ NEXT_PUBLIC_PROD_ORIGIN="${process.env.NEXT_PUBLIC_PROD_ORIGIN}"`}

return error ? (
<Alert className="mb-5 max-w-md z-50" type="error" title={title} message={message}>
<Button className="mt-3" onPress={() => handleCopyError(error)}>
Copy error data
</Button>

<p className="mt-3">
<span className="font-medium">If you are the owner/developer for this community,</span>{" "}
please visit our{" "}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ export function ExpungementRequestsTab(props: Props) {
<Button
disabled={isDisabled}
size="xs"
onClick={() => handleCancelClick(request)}
onPress={() => handleCancelClick(request)}
variant="danger"
>
{t("cancelRequest")}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -276,7 +276,7 @@ export function AddUnitToCallModal({ onClose }: Props) {
className="p-2"
size="xs"
type="button"
onClick={() => handleRemoveUnit(unit, values, setValues)}
onPress={() => handleRemoveUnit(unit, values, setValues)}
>
<TrashFill />
</Button>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -294,7 +294,7 @@ export function Manage911CallForm({ call, isDisabled, setShowAlert, handleClose
disabled={isDisabled || state === "loading"}
className="flex items-center ml-2"
type="button"
onClick={() => {
onPress={() => {
setFieldValue("status", WhitelistStatus.ACCEPTED);
handleSubmit();
}}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ export function SmartMotorwaySignsMarker({ marker }: Props) {
variant="danger"
className="w-full"
type="button"
onClick={() => setMarkerConfiguration([])}
onPress={() => setMarkerConfiguration([])}
disabled={!hasManageSmartMotorwaysSignsPermissions}
>
Reset
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ export function DoctorVisitsTab(props: DoctorVisitsTabProps) {
<header className="flex items-center justify-between my-3">
<h1 className="text-xl font-semibold">{t("Ems.doctorVisits")}</h1>

<Button size="xs" onClick={() => modalState.openModal(ModalIds.CreateDoctorVisit)}>
<Button size="xs" onPress={() => modalState.openModal(ModalIds.CreateDoctorVisit)}>
{t("Ems.add")}
</Button>
</header>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ export function MedicalRecordsTab(props: MedicalRecordsTabProps) {
<header className="flex items-center justify-between my-3">
<h1 className="text-xl font-semibold">{t("Ems.medicalRecords")}</h1>

<Button size="xs" onClick={() => modalState.openModal(ModalIds.ManageMedicalRecords)}>
<Button size="xs" onPress={() => modalState.openModal(ModalIds.ManageMedicalRecords)}>
{t("Ems.add")}
</Button>
</header>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ export function NameSearchFooterActions(props: Props) {
<Button
key={type}
type="button"
onClick={() => handleOpenCreateRecord(type)}
onPress={() => handleOpenCreateRecord(type)}
variant="cancel"
className="px-1.5"
>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ export function ConnectionsTab({
{values.incidentId ? (
<>
<Button
onClick={() => {
onPress={() => {
modalState.openModal(ModalIds.ManageIncident);
}}
className="min-w-fit"
Expand Down Expand Up @@ -135,7 +135,7 @@ export function ConnectionsTab({
{values.call911Id ? (
<>
<Button
onClick={() => {
onPress={() => {
setCurrentlySelectedCall(call);
modalState.openModal(ModalIds.Manage911Call);
}}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ export function PrivateMessagesButton(props: Props) {

<Button
size="sm"
onClick={() => modalState.openModal(ModalIds.PrivateMessage, props.unit)}
onPress={() => modalState.openModal(ModalIds.PrivateMessage, props.unit)}
>
{t("privateMessages")}
</Button>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ export function UtilityPanel({ children, isDispatch }: Props) {
<Button
className="flex items-center gap-2"
size="xs"
onClick={() => modalState.openModal(ModalIds.EditDashboardLayout)}
onPress={() => modalState.openModal(ModalIds.EditDashboardLayout)}
>
<Grid1x2Fill />
Edit Dashboard Layout
Expand Down
2 changes: 1 addition & 1 deletion apps/client/src/pages/admin/manage/users/[id].tsx
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ export default function ManageCitizens(props: Props) {
message="This user was denied access. This user may first be approved by an administrator before any changes can be done."
title="User was denied access"
>
<Button onClick={handleAcceptUser} variant="amber" className="mt-3 max-w-fit">
<Button onPress={handleAcceptUser} variant="amber" className="mt-3 max-w-fit">
Accept this user
</Button>
</Alert>
Expand Down
2 changes: 1 addition & 1 deletion apps/client/src/pages/admin/manage/users/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ export default function ManageUsers({ data }: Props) {

{hasManagePermissions ? (
<div>
<Button onClick={() => modalState.openModal(ModalIds.PruneUsers)}>
<Button onPress={() => modalState.openModal(ModalIds.PruneUsers)}>
{t("pruneUsers")}
</Button>
</div>
Expand Down
2 changes: 1 addition & 1 deletion apps/client/src/pages/admin/values/[path].tsx
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,7 @@ export default function ValuePath({ pathValues: { totalCount, type, values: data
<span>
{getObjLength(tableState.rowSelection)} items selected.{" "}
<Button
onClick={() => setAllSelected(true)}
onPress={() => setAllSelected(true)}
variant="transparent"
className="underline"
size="xs"
Expand Down
4 changes: 2 additions & 2 deletions apps/client/src/pages/bleeter/@/[handle].tsx
Original file line number Diff line number Diff line change
Expand Up @@ -119,11 +119,11 @@ export default function BleeterProfilePage(props: BleeterProfilePageProps) {
)}
{hasAdminPermissions ? (
props.data.isVerified ? (
<Button onClick={() => handleProfileVerification()} className="text-sm" size="xs">
<Button onPress={() => handleProfileVerification()} className="text-sm" size="xs">
{t("unVerifyProfile")}
</Button>
) : (
<Button onClick={() => handleProfileVerification()} className="text-sm" size="xs">
<Button onPress={() => handleProfileVerification()} className="text-sm" size="xs">
{t("verifyProfile")}
</Button>
)
Expand Down
2 changes: 1 addition & 1 deletion apps/client/src/pages/ems-fd/hospital-services.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ export default function EmsFdIncidents({ deadCitizens }: Props) {
height: citizen.height,
actions: (
<Button
onClick={() => handleDeclareCitizenAliveClick(citizen.id)}
onPress={() => handleDeclareCitizenAliveClick(citizen.id)}
variant="success"
size="xs"
>
Expand Down

0 comments on commit b419553

Please sign in to comment.