add quick actions for creating labels, projects, and filters in GlobalSearchPalette
refactor: move stripHtml function to Helpers utility fix: update chore filters to include raw description for better search indexing enhance: implement search parameter handling for modal openings in ProjectView and LabelView
This commit is contained in:
@@ -1,3 +1,13 @@
|
||||
import '@meauxt/react-swipeable-list/dist/styles.css'
|
||||
|
||||
import {
|
||||
SwipeableList,
|
||||
SwipeableListItem,
|
||||
SwipeAction,
|
||||
TrailingActions,
|
||||
Type as ListType,
|
||||
} from '@meauxt/react-swipeable-list'
|
||||
import { Add, MoreVert, Task } from '@mui/icons-material'
|
||||
import DeleteIcon from '@mui/icons-material/Delete'
|
||||
import EditIcon from '@mui/icons-material/Edit'
|
||||
import {
|
||||
@@ -10,21 +20,11 @@ import {
|
||||
Stack,
|
||||
Typography,
|
||||
} from '@mui/joy'
|
||||
import { useQueryClient } from '@tanstack/react-query'
|
||||
import { useEffect, useState } from 'react'
|
||||
import { useTranslation } from 'react-i18next'
|
||||
import { useNavigate } from 'react-router-dom'
|
||||
import ProjectModal from '../Modals/Inputs/ProjectModal'
|
||||
import { useNavigate, useSearchParams } from 'react-router-dom'
|
||||
|
||||
import {
|
||||
Type as ListType,
|
||||
SwipeableList,
|
||||
SwipeableListItem,
|
||||
SwipeAction,
|
||||
TrailingActions,
|
||||
} from '@meauxt/react-swipeable-list'
|
||||
import '@meauxt/react-swipeable-list/dist/styles.css'
|
||||
import { Add, MoreVert, Task } from '@mui/icons-material'
|
||||
import { useQueryClient } from '@tanstack/react-query'
|
||||
import { useChores } from '../../queries/ChoreQueries'
|
||||
import { useUserProfile } from '../../queries/UserQueries'
|
||||
import { getTextColorFromBackgroundColor } from '../../utils/Colors'
|
||||
@@ -33,13 +33,14 @@ import { getIconComponent } from '../../utils/ProjectIcons'
|
||||
import { getSafeBottomStyles } from '../../utils/SafeAreaUtils'
|
||||
import { useProjectFilter } from '../Chores/hooks/useProjectFilter'
|
||||
import ConfirmationModal from '../Modals/Inputs/ConfirmationModal'
|
||||
import ProjectModal from '../Modals/Inputs/ProjectModal'
|
||||
import { useProjects } from './ProjectQueries'
|
||||
const ProjectCardContent = ({
|
||||
project,
|
||||
currentUserId,
|
||||
taskCounts = {},
|
||||
onCardClick,
|
||||
onToggleActions,
|
||||
project,
|
||||
taskCounts = {},
|
||||
}) => {
|
||||
const { t } = useTranslation('projects')
|
||||
// Check if current user owns this project
|
||||
@@ -221,7 +222,7 @@ const ProjectCardContent = ({
|
||||
|
||||
const ProjectView = () => {
|
||||
const { t } = useTranslation('projects')
|
||||
const { data: projects, isProjectsLoading, isError } = useProjects()
|
||||
const { data: projects, isError, isProjectsLoading } = useProjects()
|
||||
const { data: userProfile } = useUserProfile()
|
||||
const { data: chores = { res: [] } } = useChores(false) // false to exclude archived
|
||||
const { data: projectsData = [], isLoading: projectsLoading } = useProjects()
|
||||
@@ -230,6 +231,7 @@ const ProjectView = () => {
|
||||
!projectsLoading,
|
||||
)
|
||||
const navigate = useNavigate()
|
||||
const [searchParams, setSearchParams] = useSearchParams()
|
||||
|
||||
const [userProjects, setUserProjects] = useState([])
|
||||
const [modalOpen, setModalOpen] = useState(false)
|
||||
@@ -302,6 +304,21 @@ const ProjectView = () => {
|
||||
}
|
||||
}, [projects])
|
||||
|
||||
// ?create=1 lets other surfaces (global search quick actions) land here with
|
||||
// the create modal already open.
|
||||
useEffect(() => {
|
||||
if (searchParams.get('create') !== '1') return
|
||||
setCurrentProject(null)
|
||||
setModalOpen(true)
|
||||
setSearchParams(
|
||||
params => {
|
||||
params.delete('create')
|
||||
return params
|
||||
},
|
||||
{ replace: true },
|
||||
)
|
||||
}, [searchParams, setSearchParams])
|
||||
|
||||
// Calculate real task counts from chores data
|
||||
useEffect(() => {
|
||||
if (chores && chores.res) {
|
||||
|
||||
Reference in New Issue
Block a user