Verified Commit 21785193 authored by Marek Veselý's avatar Marek Veselý
Browse files

fix: room view filters

parent bbaff4b9
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -17,7 +17,8 @@ export const displayActionFilter = ({
}): boolean => {
  const { team, details, logType } = actionLog

  if (!displayAction.all) {
  // if displayAction.all === null, displayAction.all is not used
  if (displayAction.all === false) {
    return false
  }
  if (!displayAction.types[ACTION_TYPES.indexOf(logType)]) {
+2 −2
Original line number Diff line number Diff line
@@ -169,7 +169,7 @@ export const ActionLogOptions: FC<ActionLogOptionsProps> = ({
  )

  const filters = (() => {
    if (displayAuto && setDisplayAuto) {
    if (displayAuto && setDisplayAuto && displayAction.all !== null) {
      return (
        <>
          <Checkbox
@@ -207,7 +207,7 @@ export const ActionLogOptions: FC<ActionLogOptionsProps> = ({

  const setAllDisplayStates = (state: boolean) => {
    setDisplayAction(prev => ({
      all: state,
      all: prev.all === null ? null : state,
      types: prev.types.map(() => state),
      email: {
        sent: state,
+1 −1
Original line number Diff line number Diff line
@@ -6,7 +6,7 @@ export type DisplayAutoType = {
}

export type DisplayActionType = {
  all: boolean
  all: boolean | null // use null when only using DisplayAction (without DisplayAuto)
  types: boolean[]
  email: {
    sent: boolean
+4 −1
Original line number Diff line number Diff line
@@ -9,10 +9,12 @@ export const useActionLogOptionsProps = ({
  teamCount,
  teamLimitDefault,
  selectedTeamId,
  withAuto,
}: {
  teamCount: number
  teamLimitDefault: TeamLimitOptions
  selectedTeamId: string | null
  withAuto?: boolean
}): ActionLogOptionsProps => {
  const tools = useTools()

@@ -28,7 +30,7 @@ export const useActionLogOptionsProps = ({
  }, [selectedTeamId, teamLimitDefault])

  const [displayAction, setDisplayAction] = useState<DisplayActionType>({
    all: true,
    all: withAuto ? true : null,
    types: ACTION_TYPES.map(() => true),
    email: {
      sent: true,
@@ -60,6 +62,7 @@ export const useActionLogOptionsWithAutoProps = ({
    teamCount,
    teamLimitDefault,
    selectedTeamId,
    withAuto: true,
  })

  const [displayAuto, setDisplayAuto] = useState<DisplayAutoType>({