Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { useState, useEffect, ReactNode } from "react";
import { useState, useEffect } from "react";
import { Button, Icon, Input, Select } from "@canonical/react-components";

import type {
Expand All @@ -19,7 +19,7 @@ function AppPagination<T extends ItemType>({
keyword,
items,
setItemsToShow,
}: Props<T>): ReactNode {
}: Props<T>): React.JSX.Element {
const paginationOptions = [
{
label: "25/page",
Expand Down
4 changes: 1 addition & 3 deletions static/js/publisher/components/Filter/Filter.tsx
Original file line number Diff line number Diff line change
@@ -1,15 +1,13 @@
import { useSearchParams } from "react-router-dom";
import { RecoilState, useSetRecoilState } from "recoil";
import { Button, Icon } from "@canonical/react-components";
import { ReactNode } from "react";

type Props = {
state: RecoilState<string>;
label: string;
placeholder: string;
};

function Filter({ state, label, placeholder }: Props): ReactNode {
function Filter({ state, label, placeholder }: Props): React.JSX.Element {
const [searchParams, setSearchParams] = useSearchParams();
const setFilter = useSetRecoilState(state);

Expand Down
2 changes: 1 addition & 1 deletion static/js/publisher/components/Logo/Logo.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
function Logo(): JSX.Element {
function Logo(): React.JSX.Element {
return (
<a href="/" className="p-panel__logo tag-logo">
<img
Expand Down
4 changes: 1 addition & 3 deletions static/js/publisher/components/Navigation/Logo.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
import { ReactNode } from "react";

function Logo(): ReactNode {
function Logo(): React.JSX.Element {
return (
<a href="/" className="p-panel__logo">
<img
Expand Down
4 changes: 2 additions & 2 deletions static/js/publisher/components/Navigation/Navigation.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { useState, useEffect, ReactNode } from "react";
import { useState, useEffect } from "react";
import { useRecoilState, useRecoilValue } from "recoil";
import { useParams, NavLink } from "react-router-dom";
import { Icon } from "@canonical/react-components";
Expand All @@ -16,7 +16,7 @@ function Navigation({
sectionName,
}: {
sectionName: string | null;
}): ReactNode {
}): React.JSX.Element {
const brandStoresList = useRecoilValue(brandStoresState);
const { id } = useParams();
const { data: brand } = useBrand(id);
Expand Down
2 changes: 1 addition & 1 deletion static/js/publisher/components/PrimaryNav/PrimaryNav.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ function PrimaryNav({
}: {
collapseNavigation: boolean;
setCollapseNavigation: (value: boolean) => void;
}): JSX.Element {
}): React.JSX.Element {
const location = useLocation();
const { data: publisherData } = usePublisher();
const { data: validationSetsData } = useValidationSets();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { useState, useEffect, ReactNode } from "react";
import { useState, useEffect } from "react";
import { useRecoilValue } from "recoil";
import { useParams, NavLink } from "react-router-dom";

Expand All @@ -10,7 +10,7 @@ type Props = {
nativeNavLink?: boolean;
};

function StoreSelector({ nativeNavLink }: Props): ReactNode {
function StoreSelector({ nativeNavLink }: Props): React.JSX.Element {
const { id } = useParams();
const brandStoresList = useRecoilValue(brandStoresState);
const [showStoreSelector, setShowStoreSelector] = useState<boolean>(false);
Expand Down
2 changes: 1 addition & 1 deletion static/js/publisher/components/Tour/Tour.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ type Props = {
steps: {
target: string;
title: string;
content: JSX.Element;
content: React.JSX.Element;
disableBeacon?: boolean;
}[];
};
Expand Down
4 changes: 2 additions & 2 deletions static/js/publisher/pages/AccountDetails/AccountDetails.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { useState, useEffect, SyntheticEvent, ReactNode } from "react";
import { useState, useEffect, SyntheticEvent } from "react";
import { useRecoilValue } from "recoil";
import {
Row,
Expand All @@ -13,7 +13,7 @@ import Navigation from "../../components/Navigation";

import { publisherState } from "../../state/publisherState";

function AccountDetails(): ReactNode {
function AccountDetails(): React.JSX.Element {
const [subscriptionPreferencesChanged, setSubscriptionPreferencesChanged] =
useState(false);
const [subscribeToNewsletter, setSubscribeToNewsletter] = useState(false);
Expand Down
2 changes: 1 addition & 1 deletion static/js/publisher/pages/Build/Build.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import SectionNav from "../../components/SectionNav";

import { setPageTitle } from "../../utils";

function Build(): JSX.Element {
function Build(): React.JSX.Element {
const { buildId, snapId } = useParams();
const { data, isFetched, isLoading, isFetching } = useQuery({
queryKey: ["build", snapId, buildId],
Expand Down
2 changes: 1 addition & 1 deletion static/js/publisher/pages/Builds/Builds.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import {

import { setPageTitle } from "../../utils";

function Builds(): JSX.Element {
function Builds(): React.JSX.Element {
const { snapId } = useParams();
const [githubData, setGithubData] = useRecoilState(githubDataState);
const [loggedIn, setLoggedIn] = useRecoilState(buildLoggedInState);
Expand Down
2 changes: 1 addition & 1 deletion static/js/publisher/pages/Builds/DisconnectRepoActions.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ type Props = {
function DisconnectRepoActions({
setDisconnectModalOpen,
githubData,
}: Props): JSX.Element {
}: Props): React.JSX.Element {
const { snapId } = useParams();
const setRepoConnected = useSetRecoilState(buildRepoConnectedState);
const [disconnecting, setDisconnecting] = useState<boolean>(false);
Expand Down
4 changes: 2 additions & 2 deletions static/js/publisher/pages/Builds/RepoConnected.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ function RepoConnected({
}: {
autoTriggerBuild: boolean;
setAutoTriggerBuild: Dispatch<SetStateAction<boolean>>;
}): JSX.Element {
}): React.JSX.Element {
const { snapId } = useParams();
const githubData = useRecoilValue(githubDataState);
const [disconnectModalOpen, setDisconnectModalOpen] =
Expand Down Expand Up @@ -54,7 +54,7 @@ function RepoConnected({
});
};

const formatStatus = (status: string): JSX.Element => {
const formatStatus = (status: string): React.JSX.Element => {
switch (status) {
case "never_built":
return <>Never built</>;
Expand Down
2 changes: 1 addition & 1 deletion static/js/publisher/pages/Builds/RepoNotConnected.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ function RepoNotConnected({
setAutoTriggerBuild,
}: {
setAutoTriggerBuild: Dispatch<SetStateAction<boolean>>;
}): JSX.Element {
}): React.JSX.Element {
const githubData = useRecoilValue<GithubData | null>(githubDataState);

return (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ function AdditionalInformation({
getValues,
setValue,
watch,
}: Props): JSX.Element {
}: Props): React.JSX.Element {
return (
<>
<h2 className="p-heading--4">Additional information</h2>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ function ContactFields({
labelName,
fieldName,
getValues,
}: Props): JSX.Element {
}: Props): React.JSX.Element {
const { fields, append, remove } = useFieldArray({
control,
name: fieldName,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ function ContactInformation({
control,
getFieldState,
getValues,
}: Props): JSX.Element {
}: Props): React.JSX.Element {
return (
<>
<h2 className="p-heading--4">Contact information</h2>
Expand Down
2 changes: 1 addition & 1 deletion static/js/publisher/pages/Listing/Listing.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import ListingForm from "./ListingForm";

import { setPageTitle } from "../../utils";

function Listing(): JSX.Element {
function Listing(): React.JSX.Element {
const { snapId } = useParams();
const { data, isLoading, refetch, status } = useQuery({
queryKey: ["listing"],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ function ListingDetails({
getValues,
setValue,
control,
}: Props): JSX.Element {
}: Props): React.JSX.Element {
const [showSupportedMarkdownSyntax, setShowSupportedMarkdownSyntax] =
useState<boolean>(false);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ type Props = {
refetch: () => void;
};

function ListingForm({ data, refetch }: Props): JSX.Element {
function ListingForm({ data, refetch }: Props): React.JSX.Element {
const { snapId } = useParams();

const {
Expand Down
4 changes: 2 additions & 2 deletions static/js/publisher/pages/Members/InviteModal.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Dispatch, ReactNode, SetStateAction } from "react";
import { Dispatch, SetStateAction } from "react";
import { Modal, Button } from "@canonical/react-components";
import type { InviteActionData } from "../../types/shared";

Expand All @@ -16,7 +16,7 @@ function InviteModal({
setInviteModalOpen,
updateInvite,
inviteModalIsSaving,
}: Props): ReactNode {
}: Props): React.JSX.Element | null {
if (!inviteModalOpen || !inviteActionData) {
return null;
}
Expand Down
10 changes: 2 additions & 8 deletions static/js/publisher/pages/Members/InvitesTable.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,4 @@
import {
useState,
useEffect,
ReactNode,
Dispatch,
SetStateAction,
} from "react";
import { useState, useEffect, Dispatch, SetStateAction } from "react";
import { useParams } from "react-router-dom";
import { format } from "date-fns";
import { MainTable, Button } from "@canonical/react-components";
Expand Down Expand Up @@ -34,7 +28,7 @@ function InvitesTable({
setShowSuccessNotification,
setNotificationText,
setShowErrorNotification,
}: Props): ReactNode {
}: Props): React.JSX.Element {
const [pendingInvites, setPendingInvites] = useState<Invite[]>([]);
const [expiredInvites, setExpiredInvites] = useState<Invite[]>([]);
const [revokedInvites, setRevokedInvites] = useState<Invite[]>([]);
Expand Down
4 changes: 2 additions & 2 deletions static/js/publisher/pages/Members/Members.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { ChangeEvent, ReactNode, useEffect, useState } from "react";
import { ChangeEvent, useEffect, useState } from "react";
import { useParams, Navigate } from "react-router-dom";
import { useRecoilValue } from "recoil";
import {
Expand Down Expand Up @@ -41,7 +41,7 @@ type Member = {
current_user: boolean;
};

function Members(): ReactNode {
function Members(): React.JSX.Element {
const brandStoresList = useRecoilValue(brandStoresState);
const { id } = useParams();
const {
Expand Down
4 changes: 2 additions & 2 deletions static/js/publisher/pages/Members/MembersTable.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { useState, useEffect, ReactNode } from "react";
import { useState, useEffect } from "react";
import { MainTable, CheckboxInput } from "@canonical/react-components";
import ROLES from "./memberRoles";

Expand All @@ -14,7 +14,7 @@ function MembersTable({
filteredMembers,
changedMembers,
setChangedMembers,
}: Props): ReactNode {
}: Props): React.JSX.Element {
const [members, setMembers] = useState<Member[]>(filteredMembers);

const checkArrayEqual = (array1: Array<string>, array2: Array<string>) => {
Expand Down
6 changes: 5 additions & 1 deletion static/js/publisher/pages/Metrics/ActiveDeviceAnnotation.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,11 @@ interface IActiveDeviceAnnotation {
}>;
}

function ActiveDeviceAnnotation({ snapId }: { snapId?: string }): JSX.Element {
function ActiveDeviceAnnotation({
snapId,
}: {
snapId?: string;
}): React.JSX.Element {
const { data: annotation }: { data: IActiveDeviceAnnotation | undefined } =
useMetricsAnnotation(snapId);

Expand Down
2 changes: 1 addition & 1 deletion static/js/publisher/pages/Metrics/ActiveDeviceMetrics.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ function ActiveDeviceMetrics({
}: {
isEmpty: boolean;
onDataLoad: (dataLength: number | undefined) => void;
}): JSX.Element {
}): React.JSX.Element {
const { snapId } = useParams();
const [searchParams, setSearchParams] = useSearchParams();
const { data: latestActiveDevices } = useLatestActiveDevicesMetric(snapId);
Expand Down
2 changes: 1 addition & 1 deletion static/js/publisher/pages/Metrics/Metrics.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ const EmptyData = () => {
);
};

function Metrics(): JSX.Element {
function Metrics(): React.JSX.Element {
const { snapId } = useParams();

const [isActiveDeviceMetricEmpty, setIsActiveDeviceMetricEmpty] = useState<
Expand Down
2 changes: 1 addition & 1 deletion static/js/publisher/pages/Metrics/TerritoryMetrics.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ export const TerritoryMetrics = ({
}: {
isEmpty: boolean;
onDataLoad: (dataLength: number | undefined) => void;
}): JSX.Element => {
}): React.JSX.Element => {
const { snapId } = useParams();
const {
status,
Expand Down
10 changes: 2 additions & 8 deletions static/js/publisher/pages/Model/CreatePolicyForm.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,4 @@
import {
useState,
useEffect,
ReactNode,
Dispatch,
SetStateAction,
} from "react";
import { useState, useEffect, Dispatch, SetStateAction } from "react";
import { useRecoilState, useRecoilValue } from "recoil";
import { useParams, Link, useNavigate, useLocation } from "react-router-dom";
import { useMutation, useQueryClient } from "react-query";
Expand All @@ -29,7 +23,7 @@ function CreatePolicyForm({
setShowNotification,
setShowErrorNotification,
refetchPolicies,
}: Props): ReactNode {
}: Props): React.JSX.Element {
const { id, model_id } = useParams();
const brandId = useRecoilValue(brandIdState);
const navigate = useNavigate();
Expand Down
2 changes: 1 addition & 1 deletion static/js/publisher/pages/Model/ModelBreadcrumb.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ interface RouteParams {
id?: string;
model_id?: string;
}
function ModelBreadcrumb(): JSX.Element {
function ModelBreadcrumb(): React.JSX.Element {
const { id, model_id } = useParams() as RouteParams;

return (
Expand Down
3 changes: 1 addition & 2 deletions static/js/publisher/pages/Model/ModelNav.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { ReactNode } from "react";
import { Link, useParams } from "react-router-dom";

function ModelNav({ sectionName }: { sectionName: string }): ReactNode {
function ModelNav({ sectionName }: { sectionName: string }): React.JSX.Element {
const { id, model_id } = useParams();

return (
Expand Down
4 changes: 2 additions & 2 deletions static/js/publisher/pages/Model/Policies.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { useState, useEffect, ReactNode } from "react";
import { useState, useEffect } from "react";
import {
Link,
useParams,
Expand Down Expand Up @@ -32,7 +32,7 @@ import { isClosedPanel, setPageTitle } from "../../utils";

import type { Policy, SigningKey } from "../../types/shared";

function Policies(): ReactNode {
function Policies(): React.JSX.Element {
const { id, model_id } = useParams();
const brandId = useRecoilValue(brandIdState);
const location = useLocation();
Expand Down
4 changes: 2 additions & 2 deletions static/js/publisher/pages/Model/PoliciesTable.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { ReactNode, SetStateAction, useState, Dispatch } from "react";
import { SetStateAction, useState, Dispatch } from "react";
import { useRecoilState, useRecoilValue } from "recoil";
import { useParams } from "react-router-dom";
import { format } from "date-fns";
Expand All @@ -21,7 +21,7 @@ type Props = {
function ModelsTable({
setShowDeletePolicyNotification,
setShowDeletePolicyErrorNotification,
}: Props): ReactNode {
}: Props): React.JSX.Element {
const { model_id } = useParams();
const brandId = useRecoilValue(brandIdState);
const [policiesList, setPoliciesList] = useRecoilState(
Expand Down
Loading