Skip to content

Commit

Permalink
refactor(ui): lines uglified by Prettier (#417)
Browse files Browse the repository at this point in the history
  • Loading branch information
bouassaba authored Dec 1, 2024
1 parent 819414c commit b943b65
Show file tree
Hide file tree
Showing 17 changed files with 70 additions and 68 deletions.
4 changes: 2 additions & 2 deletions ui/src/components/account/account-menu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ import { getPictureUrl } from '@/lib/helpers/picture'

const AccountMenu = () => {
const { data: user } = UserAPI.useGet(swrConfig())
const { data: invitationCount } =
InvitationAPI.useGetIncomingCount(swrConfig())
// prettier-ignore
const { data: invitationCount } = InvitationAPI.useGetIncomingCount(swrConfig())

return (
<KouprAccountMenu
Expand Down
8 changes: 4 additions & 4 deletions ui/src/components/sharing/sharing-group-form.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -64,10 +64,10 @@ const SharingGroupForm = () => {
isSingleSelection ? selection[0] : undefined,
)
const workspaceIsReady = workspace && !workspaceError
const groupListIsEmpty =
groupList && !groupListError && groupList.totalElements === 0
const groupListIsReady =
groupList && !groupListError && groupList.totalElements > 0
// prettier-ignore
const groupListIsEmpty = groupList && !groupListError && groupList.totalElements === 0
// prettier-ignore
const groupListIsReady = groupList && !groupListError && groupList.totalElements > 0

const handleGrantPermission = useCallback(async () => {
if (!group || !permission) {
Expand Down
8 changes: 4 additions & 4 deletions ui/src/components/sharing/sharing-group-permissions.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,10 @@ const SharingGroupPermissions = () => {
isLoading: permissionsIsLoading,
mutate: mutatePermissions,
} = FileAPI.useGetGroupPermissions(selection[0], swrConfig())
const permissionsIsEmpty =
permissions && !permissionsError && permissions.length === 0
const permissionsIsReady =
permissions && !permissionsError && permissions.length > 0
// prettier-ignore
const permissionsIsEmpty = permissions && !permissionsError && permissions.length === 0
// prettier-ignore
const permissionsIsReady = permissions && !permissionsError && permissions.length > 0

const handleRevokePermission = useCallback(
async (permission: GroupPermission) => {
Expand Down
8 changes: 4 additions & 4 deletions ui/src/components/sharing/sharing-user-form.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -65,10 +65,10 @@ const SharingUserForm = () => {
isSingleSelection ? selection[0] : undefined,
)
const workspaceIsReady = workspace && !workspaceError
const userListIsEmpty =
userList && !userListError && userList.totalElements === 0
const userListIsReady =
userList && !userListError && userList.totalElements > 0
// prettier-ignore
const userListIsEmpty = userList && !userListError && userList.totalElements === 0
// prettier-ignore
const userListIsReady = userList && !userListError && userList.totalElements > 0

const handleGrantPermission = useCallback(async () => {
if (!user || !permission) {
Expand Down
8 changes: 4 additions & 4 deletions ui/src/components/sharing/sharing-user-permissions.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -49,10 +49,10 @@ const SharingUserPermissions = () => {
isLoading: permissionsIsLoading,
mutate: mutatePermissions,
} = FileAPI.useGetUserPermissions(selection[0], swrConfig())
const permissionsIsEmpty =
permissions && !permissionsError && permissions.length === 0
const permissionsIsReady =
permissions && !permissionsError && permissions.length > 0
// prettier-ignore
const permissionsIsEmpty = permissions && !permissionsError && permissions.length === 0
// prettier-ignore
const permissionsIsReady = permissions && !permissionsError && permissions.length > 0

const handleRevokePermission = useCallback(
async (permission: UserPermission) => {
Expand Down
8 changes: 4 additions & 4 deletions ui/src/pages/console/console-panel-groups.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -52,12 +52,12 @@ const ConsolePanelGroups = () => {
storage: consoleGroupsPaginationStorage(),
})
const [isConfirmationOpen, setIsConfirmationOpen] = useState(false)
const [isConfirmationDestructive, setIsConfirmationDestructive] =
useState(false)
// prettier-ignore
const [isConfirmationDestructive, setIsConfirmationDestructive] = useState(false)
const [confirmationHeader, setConfirmationHeader] = useState<ReactElement>()
const [confirmationBody, setConfirmationBody] = useState<ReactElement>()
const [confirmationRequest, setConfirmationRequest] =
useState<ConsoleConfirmationModalRequest>()
// prettier-ignore
const [confirmationRequest, setConfirmationRequest] = useState<ConsoleConfirmationModalRequest>()
const {
data: list,
error: listError,
Expand Down
24 changes: 12 additions & 12 deletions ui/src/pages/console/console-panel-organization.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -86,18 +86,18 @@ const ConsolePanelOrganization = () => {
swrConfig(),
)
const orgIsReady = org && !orgError
const userListIsEmpty =
userList && !userListError && userList.totalElements === 0
const userListIsReady =
userList && !userListError && userList.totalElements > 0
const workspaceListIsEmpty =
workspaceList && !workspaceListError && workspaceList.totalElements === 0
const workspaceListIsReady =
workspaceList && !workspaceListError && workspaceList.totalElements > 0
const groupListIsEmpty =
groupList && !groupListError && groupList.totalElements === 0
const groupListIsReady =
groupList && !groupListError && groupList.totalElements > 0
// prettier-ignore
const userListIsEmpty = userList && !userListError && userList.totalElements === 0
// prettier-ignore
const userListIsReady = userList && !userListError && userList.totalElements > 0
// prettier-ignore
const workspaceListIsEmpty = workspaceList && !workspaceListError && workspaceList.totalElements === 0
// prettier-ignore
const workspaceListIsReady = workspaceList && !workspaceListError && workspaceList.totalElements > 0
// prettier-ignore
const groupListIsEmpty = groupList && !groupListError && groupList.totalElements === 0
// prettier-ignore
const groupListIsReady = groupList && !groupListError && groupList.totalElements > 0

return (
<>
Expand Down
8 changes: 4 additions & 4 deletions ui/src/pages/console/console-panel-organizations.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -51,12 +51,12 @@ const ConsolePanelOrganizations = () => {
storage: consoleOrganizationsPaginationStorage(),
})
const [isConfirmationOpen, setIsConfirmationOpen] = useState(false)
const [isConfirmationDestructive, setIsConfirmationDestructive] =
useState(false)
// prettier-ignore
const [isConfirmationDestructive, setIsConfirmationDestructive] = useState(false)
const [confirmationHeader, setConfirmationHeader] = useState<ReactElement>()
const [confirmationBody, setConfirmationBody] = useState<ReactElement>()
const [confirmationRequest, setConfirmationRequest] =
useState<ConsoleConfirmationModalRequest>()
// prettier-ignore
const [confirmationRequest, setConfirmationRequest] = useState<ConsoleConfirmationModalRequest>()
const {
data: list,
error: listError,
Expand Down
4 changes: 2 additions & 2 deletions ui/src/pages/console/console-panel-overview.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,8 @@ const internalComponents = [
{ id: 'console' },
{ id: 'conversion' },
]
const compareFn = (a: ComponentVersion, b: ComponentVersion) =>
a.name > b.name ? 1 : 0
// prettier-ignore
const compareFn = (a: ComponentVersion, b: ComponentVersion) => a.name > b.name ? 1 : 0

const ConsolePanelOverview = () => {
const [userCount, setUserCount] = useState<number>()
Expand Down
16 changes: 8 additions & 8 deletions ui/src/pages/console/console-panel-user.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -85,16 +85,16 @@ const ConsolePanelUser = () => {
swrConfig(),
)
const userIsReady = user && !userError
const groupListIsEmpty =
groupList && !groupListError && groupList.totalElements === 0
const groupListIsReady =
groupList && !groupListError && groupList.totalElements > 0
// prettier-ignore
const groupListIsEmpty = groupList && !groupListError && groupList.totalElements === 0
// prettier-ignore
const groupListIsReady = groupList && !groupListError && groupList.totalElements > 0
const orgListIsEmpty = orgList && !orgListError && orgList.totalElements === 0
const orgListIsReady = orgList && !orgListError && orgList.totalElements > 0
const workspaceListIsEmpty =
workspaceList && !workspaceListError && workspaceList.totalElements === 0
const workspaceListIsReady =
workspaceList && !workspaceListError && workspaceList.totalElements > 0
// prettier-ignore
const workspaceListIsEmpty = workspaceList && !workspaceListError && workspaceList.totalElements === 0
// prettier-ignore
const workspaceListIsReady = workspaceList && !workspaceListError && workspaceList.totalElements > 0

return (
<>
Expand Down
14 changes: 8 additions & 6 deletions ui/src/pages/console/console-panel-users.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -46,16 +46,15 @@ import userToString from '@/lib/helpers/user-to-string'

const ConsolePanelUsers = () => {
const [searchParams] = useSearchParams()
const query = decodeQuery(searchParams.get('q') as string)
const navigate = useNavigate()
const location = useLocation()
const [isConfirmationOpen, setIsConfirmationOpen] = useState(false)
const [isConfirmationDestructive, setIsConfirmationDestructive] =
useState(false)
// prettier-ignore
const [isConfirmationDestructive, setIsConfirmationDestructive] = useState(false)
const [confirmationHeader, setConfirmationHeader] = useState<ReactElement>()
const [confirmationBody, setConfirmationBody] = useState<ReactElement>()
const [confirmationRequest, setConfirmationRequest] =
useState<ConsoleConfirmationModalRequest>()
// prettier-ignore
const [confirmationRequest, setConfirmationRequest] = useState<ConsoleConfirmationModalRequest>()
const { page, size, steps, setPage, setSize } = usePagePagination({
navigateFn: navigate,
searchFn: () => location.search,
Expand All @@ -66,7 +65,10 @@ const ConsolePanelUsers = () => {
error: listError,
isLoading: listIsLoading,
mutate,
} = UserAPI.useList({ query, page, size }, swrConfig())
} = UserAPI.useList(
{ query: decodeQuery(searchParams.get('q') as string), page, size },
swrConfig(),
)
const { hasPagination } = usePageMonitor({
totalPages: list?.totalPages ?? 1,
totalElements: list?.totalElements ?? 0,
Expand Down
8 changes: 4 additions & 4 deletions ui/src/pages/console/console-panel-workspaces.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -53,12 +53,12 @@ const ConsolePanelWorkspaces = () => {
storage: consoleWorkspacesPaginationStorage(),
})
const [isConfirmationOpen, setIsConfirmationOpen] = useState(false)
const [isConfirmationDestructive, setIsConfirmationDestructive] =
useState(false)
// prettier-ignore
const [isConfirmationDestructive, setIsConfirmationDestructive] = useState(false)
const [confirmationHeader, setConfirmationHeader] = useState<ReactElement>()
const [confirmationBody, setConfirmationBody] = useState<ReactElement>()
const [confirmationRequest, setConfirmationRequest] =
useState<ConsoleConfirmationModalRequest>()
// prettier-ignore
const [confirmationRequest, setConfirmationRequest] = useState<ConsoleConfirmationModalRequest>()
const {
data: list,
error: listError,
Expand Down
4 changes: 2 additions & 2 deletions ui/src/pages/group/group-members-page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -79,8 +79,8 @@ const GroupMembersPage = () => {
)
const [userToRemove, setUserToRemove] = useState<IdPUser>()
const [isAddMembersModalOpen, setIsAddMembersModalOpen] = useState(false)
const [isRemoveMemberModalOpen, setIsRemoveMemberModalOpen] =
useState<boolean>(false)
// prettier-ignore
const [isRemoveMemberModalOpen, setIsRemoveMemberModalOpen] = useState<boolean>(false)
const { hasPagination } = usePageMonitor({
totalPages: list?.totalPages ?? 1,
totalElements: list?.totalElements ?? 0,
Expand Down
4 changes: 2 additions & 2 deletions ui/src/pages/organization/organization-invitations-page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,8 @@ const OrganizationInvitationsPage = () => {
},
swrConfig(),
)
const [isInviteMembersModalOpen, setIsInviteMembersModalOpen] =
useState(false)
// prettier-ignore
const [isInviteMembersModalOpen, setIsInviteMembersModalOpen] = useState(false)
const orgIsReady = org && !orgError
const listIsEmpty = list && !listError && list.totalElements === 0
const listIsReady = list && !listError && list.totalElements > 0
Expand Down
4 changes: 2 additions & 2 deletions ui/src/pages/organization/organization-members-page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -82,8 +82,8 @@ const OrganizationMembersPage = () => {
(state) => state.ui.organizations.isInviteModalOpen,
)
const [userToRemove, setUserToRemove] = useState<User>()
const [isRemoveMemberModalOpen, setIsRemoveMemberModalOpen] =
useState<boolean>(false)
// prettier-ignore
const [isRemoveMemberModalOpen, setIsRemoveMemberModalOpen] = useState<boolean>(false)
const { hasPagination } = usePageMonitor({
totalPages: list?.totalPages ?? 1,
totalElements: list?.totalElements ?? 0,
Expand Down
4 changes: 2 additions & 2 deletions ui/src/pages/organization/organization-settings-page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@ const OrganizationSettingsPage = () => {
isLoading: orgIsLoading,
} = OrganizationAPI.useGet(id, swrConfig())
const [isNameModalOpen, setIsNameModalOpen] = useState(false)
const [isInviteMembersModalOpen, setIsInviteMembersModalOpen] =
useState(false)
// prettier-ignore
const [isInviteMembersModalOpen, setIsInviteMembersModalOpen] = useState(false)
const [isLeaveModalOpen, setIsLeaveModalOpen] = useState(false)
const [isDeleteModalOpen, setIsDeleteModalOpen] = useState(false)
const orgIsReady = org && !orgError
Expand Down
4 changes: 2 additions & 2 deletions ui/src/pages/workspace/workspace-settings-page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,8 @@ const WorkspaceSettingsPage = () => {
[workspace],
)
const [isNameModalOpen, setIsNameModalOpen] = useState(false)
const [isStorageCapacityModalOpen, setIsStorageCapacityModalOpen] =
useState(false)
// prettier-ignore
const [isStorageCapacityModalOpen, setIsStorageCapacityModalOpen] = useState(false)
const [isDeleteModalOpen, setIsDeleteModalOpen] = useState(false)
const workspaceIsReady = workspace && !workspaceError
const storageUsageIsReady = storageUsage && !storageUsageError
Expand Down

0 comments on commit b943b65

Please sign in to comment.