Skip to content

Commit

Permalink
refactor: rename to ClientOnly
Browse files Browse the repository at this point in the history
  • Loading branch information
adrianflatner committed Nov 7, 2024
1 parent 108fc2a commit 6ec80b8
Show file tree
Hide file tree
Showing 17 changed files with 52 additions and 52 deletions.
6 changes: 3 additions & 3 deletions tavla/app/(admin)/boards/components/Column/Actions.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { Delete } from './Delete'
import { Open } from 'app/(admin)/edit/[id]/components/Buttons/Open'
import { Copy } from 'app/(admin)/edit/[id]/components/Buttons/Copy'
import { Tooltip } from '@entur/tooltip'
import ClientOnlyComponent from 'app/components/NoSSR/ClientOnlyComponent'
import ClientOnly from 'app/components/NoSSR/ClientOnly'

function Actions({ board }: { board: TBoard }) {
return (
Expand All @@ -24,7 +24,7 @@ function Actions({ board }: { board: TBoard }) {

function Edit({ bid }: { bid?: string }) {
return (
<ClientOnlyComponent>
<ClientOnly>
<Tooltip content="Rediger tavle" placement="bottom">
<IconButton
as={Link}
Expand All @@ -34,7 +34,7 @@ function Edit({ bid }: { bid?: string }) {
<EditIcon />
</IconButton>
</Tooltip>
</ClientOnlyComponent>
</ClientOnly>
)
}

Expand Down
6 changes: 3 additions & 3 deletions tavla/app/(admin)/boards/components/Column/Delete.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import { SubmitButton } from 'components/Form/SubmitButton'
import { OverflowMenuItem } from '@entur/menu'
import { useToast } from '@entur/alert'
import { deleteBoardAction } from '../../utils/actions'
import ClientOnlyComponent from 'app/components/NoSSR/ClientOnlyComponent'
import ClientOnly from 'app/components/NoSSR/ClientOnly'

function Delete({
board,
Expand All @@ -37,11 +37,11 @@ function Delete({

return (
<>
<ClientOnlyComponent>
<ClientOnly>
<Tooltip content="Slett tavle" placement="bottom">
<DeleteButton type={type} onClick={open} />
</Tooltip>
</ClientOnlyComponent>
</ClientOnly>
<Modal
open={isOpen}
size="small"
Expand Down
6 changes: 3 additions & 3 deletions tavla/app/(admin)/boards/components/Column/Tags.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import { Column } from './Column'
import { colorsFromHash, sortArrayByOverlap } from '../../utils'
import { TagsContext } from '../../utils/context'
import { useSearchParam } from '../../hooks/useSearchParam'
import ClientOnlyComponent from 'app/components/NoSSR/ClientOnlyComponent'
import ClientOnly from 'app/components/NoSSR/ClientOnly'

function TagList({ tags, children }: { tags: TTag[]; children?: ReactNode }) {
return (
Expand Down Expand Up @@ -62,7 +62,7 @@ function Tags({
<TagModal board={board} />
<TagList tags={tags.slice(0, displayNumber)}>
{hiddenNumber > 0 && (
<ClientOnlyComponent>
<ClientOnly>
<Tooltip
placement="bottom"
content={
Expand All @@ -75,7 +75,7 @@ function Tags({
+ {hiddenNumber}
</Badge>
</Tooltip>
</ClientOnlyComponent>
</ClientOnly>
)}
</TagList>
</div>
Expand Down
6 changes: 3 additions & 3 deletions tavla/app/(admin)/boards/components/TagModal/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,15 @@ import { getFormFeedbackForField } from 'app/(admin)/utils'
import { useModalWithValue } from '../../hooks/useModalWithValue'
import { DEFAULT_BOARD_NAME } from 'app/(admin)/utils/constants'
import { removeTag } from './actions'
import ClientOnlyComponent from 'app/components/NoSSR/ClientOnlyComponent'
import ClientOnly from 'app/components/NoSSR/ClientOnly'

function TagModal({ board }: { board: TBoard }) {
const tags = board.meta?.tags ?? []
const { isOpen, open, close } = useModalWithValue('addTags', board.id ?? '')
const [state, action] = useActionState(removeTag, undefined)
return (
<>
<ClientOnlyComponent>
<ClientOnly>
<Tooltip content="Administrer merkelapper" placement="bottom">
<IconButton
aria-label="Administrer merkelapper"
Expand All @@ -31,7 +31,7 @@ function TagModal({ board }: { board: TBoard }) {
<ReferenceIcon />
</IconButton>
</Tooltip>
</ClientOnlyComponent>
</ClientOnly>

<Modal
size="medium"
Expand Down
6 changes: 3 additions & 3 deletions tavla/app/(admin)/components/Delete/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import Link from 'next/link'
import { useToast } from '@entur/alert'
import { useActionState, useState } from 'react'
import { HiddenInput } from 'components/Form/HiddenInput'
import ClientOnlyComponent from 'app/components/NoSSR/ClientOnlyComponent'
import ClientOnly from 'app/components/NoSSR/ClientOnly'
import ClientOnlyTextField from 'app/components/NoSSR/TextField'

function Delete({
Expand Down Expand Up @@ -57,7 +57,7 @@ function Delete({

return (
<>
<ClientOnlyComponent>
<ClientOnly>
<Tooltip content="Slett organisasjon" placement="bottom">
<DeleteButton
as={Link}
Expand All @@ -71,7 +71,7 @@ function Delete({
<DeleteIcon />
</DeleteButton>
</Tooltip>
</ClientOnlyComponent>
</ClientOnly>
<Modal
open={modalIsOpen && pageParam === organization.id}
size="small"
Expand Down
6 changes: 3 additions & 3 deletions tavla/app/(admin)/edit/[id]/components/Buttons/Copy.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { useToast } from '@entur/alert'
import { Button, IconButton } from '@entur/button'
import { CopyIcon } from '@entur/icons'
import { Tooltip } from '@entur/tooltip'
import ClientOnlyComponent from 'app/components/NoSSR/ClientOnlyComponent'
import ClientOnly from 'app/components/NoSSR/ClientOnly'
import { useLink } from 'hooks/useLink'

function Copy({ type, bid }: { type?: 'button' | 'icon'; bid?: string }) {
Expand All @@ -27,7 +27,7 @@ function Copy({ type, bid }: { type?: 'button' | 'icon'; bid?: string }) {
)
}
return (
<ClientOnlyComponent>
<ClientOnly>
<Tooltip content="Kopier lenken til tavlen" placement="bottom">
<IconButton
aria-label="Kopier lenken til tavlen"
Expand All @@ -36,7 +36,7 @@ function Copy({ type, bid }: { type?: 'button' | 'icon'; bid?: string }) {
<CopyIcon />
</IconButton>
</Tooltip>
</ClientOnlyComponent>
</ClientOnly>
)
}
export { Copy }
6 changes: 3 additions & 3 deletions tavla/app/(admin)/edit/[id]/components/Buttons/Open.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import { Button, IconButton } from '@entur/button'
import { ExternalIcon } from '@entur/icons'
import { Tooltip } from '@entur/tooltip'
import ClientOnlyComponent from 'app/components/NoSSR/ClientOnlyComponent'
import ClientOnly from 'app/components/NoSSR/ClientOnly'
import { useLink } from 'hooks/useLink'
import Link from 'next/link'
import { usePostHog } from 'posthog-js/react'
Expand All @@ -28,7 +28,7 @@ function Open({ type, bid }: { type?: 'button' | 'icon'; bid?: string }) {
}

return (
<ClientOnlyComponent>
<ClientOnly>
<Tooltip content="Åpne tavle" placement="bottom">
<IconButton
as={Link}
Expand All @@ -40,7 +40,7 @@ function Open({ type, bid }: { type?: 'button' | 'icon'; bid?: string }) {
<ExternalIcon />
</IconButton>
</Tooltip>
</ClientOnlyComponent>
</ClientOnly>
)
}

Expand Down
6 changes: 3 additions & 3 deletions tavla/app/(admin)/edit/[id]/components/Footer/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { TBoardID, TFooter } from 'types/settings'
import { setFooter } from './actions'
import { useState } from 'react'
import { Tooltip } from '@entur/tooltip'
import ClientOnlyComponent from 'app/components/NoSSR/ClientOnlyComponent'
import ClientOnly from 'app/components/NoSSR/ClientOnly'
import ClientOnlyTextField from 'app/components/NoSSR/TextField'

function Footer({
Expand Down Expand Up @@ -40,14 +40,14 @@ function Footer({
<form className="box flex flex-col" action={submitOrgBoard}>
<div className="flex flex-row items-center gap-2">
<Heading3 margin="bottom">Infomelding</Heading3>
<ClientOnlyComponent>
<ClientOnly>
<Tooltip
content="Skriv en kort tekst som skal vises nederst i tavlen."
placement="top"
>
<ValidationInfoFilledIcon className="mb-3" size={20} />
</Tooltip>
</ClientOnlyComponent>
</ClientOnly>
</div>
<div className="h-full">
<ClientOnlyTextField
Expand Down
10 changes: 5 additions & 5 deletions tavla/app/(admin)/edit/[id]/components/MetaSettings/Adress.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { Tooltip } from '@entur/tooltip'
import { Heading3 } from '@entur/typography'
import { saveLocation } from 'app/(admin)/edit/[id]/components/MetaSettings/actions'
import { usePointSearch } from 'app/(admin)/hooks/usePointSearch'
import ClientOnlyComponent from 'app/components/NoSSR/ClientOnlyComponent'
import ClientOnly from 'app/components/NoSSR/ClientOnly'
import { SubmitButton } from 'components/Form/SubmitButton'
import { FormEvent } from 'react'
import { TLocation } from 'types/meta'
Expand Down Expand Up @@ -34,7 +34,7 @@ function Address({ bid, location }: { bid: TBoardID; location?: TLocation }) {
<form onSubmit={handleSubmit} className="box flex flex-col">
<div className="flex flex-row items-center gap-2">
<Heading3 margin="bottom">Adresse</Heading3>
<ClientOnlyComponent>
<ClientOnly>
<Tooltip
content="Under innstillingene til hvert stoppested kan du velge om gåavstanden, fra tavlens adresse til selve stoppestedet, skal vises"
placement="top"
Expand All @@ -44,10 +44,10 @@ function Address({ bid, location }: { bid: TBoardID; location?: TLocation }) {
size={20}
/>
</Tooltip>
</ClientOnlyComponent>
</ClientOnly>
</div>
<div className="h-full">
<ClientOnlyComponent>
<ClientOnly>
<SearchableDropdown
label="Hvor befinner tavlen seg?"
items={pointItems}
Expand All @@ -56,7 +56,7 @@ function Address({ bid, location }: { bid: TBoardID; location?: TLocation }) {
debounceTimeout={150}
clearable
/>
</ClientOnlyComponent>
</ClientOnly>
</div>
<div className="flex flex-row mt-8 justify-end">
<SubmitButton variant="secondary" className="max-sm:w-full">
Expand Down
6 changes: 3 additions & 3 deletions tavla/app/(admin)/edit/[id]/components/MetaSettings/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import {
getFormFeedbackForField,
} from 'app/(admin)/utils'
import ClientOnlyTextField from 'app/components/NoSSR/TextField'
import ClientOnlyComponent from 'app/components/NoSSR/ClientOnlyComponent'
import ClientOnly from 'app/components/NoSSR/ClientOnly'

function MetaSettings({
bid,
Expand Down Expand Up @@ -105,7 +105,7 @@ function MetaSettings({
className="box flex flex-col"
>
<Heading3 margin="bottom">Organisasjon</Heading3>
<ClientOnlyComponent>
<ClientOnly>
<Dropdown
items={organizations}
label="Dine organisasjoner"
Expand All @@ -117,7 +117,7 @@ function MetaSettings({
disabled={personal}
{...getFormFeedbackForField('organization', state)}
/>
</ClientOnlyComponent>
</ClientOnly>
<Checkbox
checked={personal}
onChange={() => setPersonal(!personal)}
Expand Down
6 changes: 3 additions & 3 deletions tavla/app/(admin)/edit/[id]/components/TileCard/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ import {
getFormFeedbackForField,
} from 'app/(admin)/utils'
import { NEW_LINE_IDS, OLD_LINE_IDS, SWITCH_DATE } from '../../compatibility'
import ClientOnlyComponent from 'app/components/NoSSR/ClientOnlyComponent'
import ClientOnly from 'app/components/NoSSR/ClientOnly'
import ClientOnlyTextField from 'app/components/NoSSR/TextField'

function TileCard({
Expand Down Expand Up @@ -381,7 +381,7 @@ function TileCard({

<div className="flex flex-row items-baseline gap-1">
<Heading4>Kolonner</Heading4>
<ClientOnlyComponent>
<ClientOnly>
<Tooltip
aria-hidden
placement="top"
Expand All @@ -397,7 +397,7 @@ function TileCard({
<QuestionFilledIcon />
</IconButton>
</Tooltip>
</ClientOnlyComponent>
</ClientOnly>
</div>
<div className="flex flex-row items-start gap-2">
<SubParagraph>
Expand Down
6 changes: 3 additions & 3 deletions tavla/app/(admin)/organizations/components/Actions.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@ import Link from 'next/link'
import { TOrganization, TUserID } from 'types/settings'
import { Delete } from 'app/(admin)/components/Delete'
import { Tooltip } from '@entur/tooltip'
import ClientOnlyComponent from 'app/components/NoSSR/ClientOnlyComponent'
import ClientOnly from 'app/components/NoSSR/ClientOnly'

function Edit({ oid }: { oid?: string }) {
return (
<ClientOnlyComponent>
<ClientOnly>
<Tooltip content="Rediger organisasjon" placement="bottom">
<IconButton
as={Link}
Expand All @@ -20,7 +20,7 @@ function Edit({ oid }: { oid?: string }) {
<EditIcon />
</IconButton>
</Tooltip>
</ClientOnlyComponent>
</ClientOnly>
)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import { Tooltip } from '@entur/tooltip'
import { IconButton } from '@entur/button'
import { QuestionFilledIcon } from '@entur/icons'
import { ColumnModal } from './ColumnModal'
import ClientOnlyComponent from 'app/components/NoSSR/ClientOnlyComponent'
import ClientOnly from 'app/components/NoSSR/ClientOnly'

function DefaultColumns({
oid,
Expand Down Expand Up @@ -53,7 +53,7 @@ function DefaultColumns({
<div className="box flex flex-col gap-1">
<div className="flex flex-row items-baseline">
<Heading2>Kolonner</Heading2>
<ClientOnlyComponent>
<ClientOnly>
<Tooltip
aria-hidden
placement="top"
Expand All @@ -67,7 +67,7 @@ function DefaultColumns({
<QuestionFilledIcon size={24} />
</IconButton>
</Tooltip>
</ClientOnlyComponent>
</ClientOnly>
</div>

<Paragraph margin="none">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { FormError } from 'app/(admin)/components/FormError'
import { SubmitButton } from 'components/Form/SubmitButton'
import { useActionState, useRef } from 'react'
import { inviteUser } from './actions'
import ClientOnlyComponent from 'app/components/NoSSR/ClientOnlyComponent'
import ClientOnly from 'app/components/NoSSR/ClientOnly'
import ClientOnlyTextField from 'app/components/NoSSR/TextField'

function InviteUser({ oid }: { oid?: TOrganizationID }) {
Expand All @@ -24,15 +24,15 @@ function InviteUser({ oid }: { oid?: TOrganizationID }) {
<div className="flex flex-col sm:flex-row gap-1">
<HiddenInput id="oid" value={oid} />
<div className="flex flex-col w-full">
<ClientOnlyComponent>
<ClientOnly>
<ClientOnlyTextField
name="email"
id="email"
label="E-post"
type="email"
{...getFormFeedbackForField('email', state)}
/>
</ClientOnlyComponent>
</ClientOnly>
</div>
<SubmitButton
aria-label="Legg til medlem"
Expand Down
Loading

0 comments on commit 6ec80b8

Please sign in to comment.