Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
20e4e3a
wire up routing
martha Apr 30, 2026
1da2aae
rename AdminReferralsTable -> ReferralsTable
martha Apr 30, 2026
9f1ded0
create ReferralsPage a
martha Apr 30, 2026
e8fbe03
register referrals link in toolbar
martha Apr 30, 2026
9d43431
update referral route call sites
martha Apr 30, 2026
0b5affc
remove old admin routes
martha Apr 30, 2026
aa41377
gate on root-level canIndexReferrals
martha Apr 30, 2026
97b423c
wire up redirects for legacy admin pages
martha May 1, 2026
9c83772
add redirects
martha May 1, 2026
ce506cb
self-review
martha May 1, 2026
d842a08
refactor with correct routes
martha May 1, 2026
c824f7d
self-review fixes
martha May 1, 2026
560ebed
rm overline text and make search big
martha May 5, 2026
f7679ec
remove /ce from routes
martha May 5, 2026
2909299
rename graphql types for clarity
martha May 6, 2026
2e5495c
Merge branch 'release-212' into mke/9157-referral-refactor
gigxz May 7, 2026
aa2e563
Add Workspace selector to Referral page
gigxz May 8, 2026
9be6324
Merge branch 'release-213' into mke/9157-referral-refactor
gigxz May 8, 2026
6da8884
Merge branch 'mke/9157-referral-refactor' into gig/8937-hmis-workspaces
gigxz May 8, 2026
776979e
Merge branch 'release-213' into gig/8937-hmis-workspaces
gigxz May 13, 2026
f40820d
merge conflict fix
gigxz May 13, 2026
ac11c05
Merge branch 'release-213' into gig/8937-hmis-workspaces
martha May 14, 2026
3136d9b
Merge branch 'release-213' into gig/8937-hmis-workspaces
gigxz May 18, 2026
d043b7b
Update lockfile
gigxz May 18, 2026
41c29ff
Merge branch 'release-213' into gig/8937-hmis-workspaces
gigxz May 18, 2026
8b60c25
Add explicit skips for projectGroupId
gigxz May 18, 2026
bdc320b
Address feedback
gigxz May 18, 2026
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
195 changes: 195 additions & 0 deletions graphql.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -4482,6 +4482,18 @@
"isDeprecated": false,
"deprecationReason": null
},
{
"name": "projectGroupId",
"description": "Filter to Clients that are eligible for projects in the specified Project Group",
"type": {
"kind": "SCALAR",
"name": "ID",
"ofType": null
},
"defaultValue": null,
"isDeprecated": false,
"deprecationReason": null
},
{
"name": "projectType",
"description": "Filter to Clients that are eligible for the specified Project Types",
Expand Down Expand Up @@ -6102,6 +6114,18 @@
"isDeprecated": false,
"deprecationReason": null
},
{
"name": "projectGroupId",
"description": null,
"type": {
"kind": "SCALAR",
"name": "ID",
"ofType": null
},
"defaultValue": null,
"isDeprecated": false,
"deprecationReason": null
},
{
"name": "projectType",
"description": null,
Expand Down Expand Up @@ -7526,6 +7550,18 @@
"isDeprecated": false,
"deprecationReason": null
},
{
"name": "projectGroupId",
"description": "Filter to referrals where the target project belongs to the specified project group",
"type": {
"kind": "SCALAR",
"name": "ID",
"ofType": null
},
"defaultValue": null,
"isDeprecated": false,
"deprecationReason": null
},
{
"name": "projectType",
"description": null,
Expand Down Expand Up @@ -12442,6 +12478,18 @@
"isDeprecated": false,
"deprecationReason": null
},
{
"name": "projectGroupId",
"description": "Filter to referrals where the target project belongs to the specified project group",
"type": {
"kind": "SCALAR",
"name": "ID",
"ofType": null
},
"defaultValue": null,
"isDeprecated": false,
"deprecationReason": null
},
{
"name": "projectType",
"description": null,
Expand Down Expand Up @@ -12788,6 +12836,18 @@
"isDeprecated": false,
"deprecationReason": null
},
{
"name": "projectGroupId",
"description": null,
"type": {
"kind": "SCALAR",
"name": "ID",
"ofType": null
},
"defaultValue": null,
"isDeprecated": false,
"deprecationReason": null
},
{
"name": "projectType",
"description": null,
Expand Down Expand Up @@ -46980,6 +47040,47 @@
},
"isDeprecated": false,
"deprecationReason": null
},
{
"name": "workspaces",
"description": null,
"args": [
{
"name": "appliesTo",
"description": null,
"type": {
"kind": "NON_NULL",
"name": null,
"ofType": {
"kind": "ENUM",
"name": "WorkspaceAppliesTo",
"ofType": null
}
},
"defaultValue": null,
"isDeprecated": false,
"deprecationReason": null
}
],
"type": {
"kind": "NON_NULL",
"name": null,
"ofType": {
"kind": "LIST",
"name": null,
"ofType": {
"kind": "NON_NULL",
"name": null,
"ofType": {
"kind": "OBJECT",
"name": "Workspace",
"ofType": null
}
}
}
},
"isDeprecated": false,
"deprecationReason": null
}
],
"inputFields": null,
Expand Down Expand Up @@ -58228,6 +58329,100 @@
],
"possibleTypes": null
},
{
"kind": "OBJECT",
"name": "Workspace",
"description": null,
"isOneOf": null,
"fields": [
{
"name": "id",
"description": null,
"args": [],
"type": {
"kind": "NON_NULL",
"name": null,
"ofType": {
"kind": "SCALAR",
"name": "ID",
"ofType": null
}
},
"isDeprecated": false,
"deprecationReason": null
},
{
"name": "name",
"description": null,
"args": [],
"type": {
"kind": "NON_NULL",
"name": null,
"ofType": {
"kind": "SCALAR",
"name": "String",
"ofType": null
}
},
"isDeprecated": false,
"deprecationReason": null
},
{
"name": "projectGroupId",
"description": null,
"args": [],
"type": {
"kind": "NON_NULL",
"name": null,
"ofType": {
"kind": "SCALAR",
"name": "ID",
"ofType": null
}
},
"isDeprecated": false,
"deprecationReason": null
},
{
"name": "slug",
"description": null,
"args": [],
"type": {
"kind": "NON_NULL",
"name": null,
"ofType": {
"kind": "SCALAR",
"name": "String",
"ofType": null
}
},
"isDeprecated": false,
"deprecationReason": null
}
],
"inputFields": null,
"interfaces": [],
"enumValues": null,
"possibleTypes": null
},
{
"kind": "ENUM",
"name": "WorkspaceAppliesTo",
"description": null,
"isOneOf": null,
"fields": null,
"inputFields": null,
"interfaces": null,
"enumValues": [
{
"name": "CE_REFERRALS",
"description": "CE referrals workspace switcher",
"isDeprecated": false,
"deprecationReason": null
}
],
"possibleTypes": null
},
{
"kind": "OBJECT",
"name": "YouthEducationStatus",
Expand Down
6 changes: 6 additions & 0 deletions src/api/operations/workspace.fragments.graphql
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
fragment WorkspaceFields on Workspace {
id
slug
name
projectGroupId
}
5 changes: 5 additions & 0 deletions src/api/operations/workspace.queries.graphql
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
query GetWorkspaces($appliesTo: WorkspaceAppliesTo!) {
workspaces(appliesTo: $appliesTo) {
...WorkspaceFields
}
}
84 changes: 84 additions & 0 deletions src/components/elements/input/WorkspaceSelect.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
import { InputAdornment } from '@mui/material';
import { Box } from '@mui/system';
import React, { useMemo } from 'react';

import GenericSelect from '@/components/elements/input/GenericSelect';
import { PickListOption, WorkspaceFieldsFragment } from '@/types/gqlTypes';

const ALL_WORKSPACES_OPTION: PickListOption = {
code: 'all',
label: 'All Projects',
};

// Circular input adornment to use as `startAdornment` in the Select input component.
// This is to bring visual attention to the workspace selector on the page, and does not have any functional purpose.
// Move to a shared component/variant (e.g. CircularAdornedInput) if needed elsewhere.
const CircularInputAdornment: React.FC = () => (
<InputAdornment position='start' aria-hidden='true' sx={{ ml: 1, mr: 0 }}>
<Box
component='span'
sx={{
width: 12,
height: 12,
borderRadius: '50%',
bgcolor: 'primary.main',
}}
/>
</InputAdornment>
);

interface Props {
selectedWorkspace?: WorkspaceFieldsFragment;
workspaces: WorkspaceFieldsFragment[];
onChange: (workspaceSlug: string | null) => void;
}

const WorkspaceSelect: React.FC<Props> = ({
selectedWorkspace,
workspaces,
onChange,
}) => {
const workspaceOptions = useMemo(
() => [
ALL_WORKSPACES_OPTION,
...workspaces.map((w) => ({
code: w.slug,
label: w.name,
})),
],
[workspaces]
);
const selectedWorkspaceOption =
workspaceOptions.find((w) => w.code === selectedWorkspace?.slug) ||
ALL_WORKSPACES_OPTION;

return (
<GenericSelect<PickListOption, false, false>
size='small'
label='Workspace'
ariaLabel='Workspace'
options={workspaceOptions}
value={selectedWorkspaceOption}
getOptionLabel={(option) => option.label || option.code}
isOptionEqualToValue={(option, value) => option.code === value.code}
blurOnSelect
disableClearable
onChange={(_event, value) =>
onChange(
value?.code === ALL_WORKSPACES_OPTION.code
? null
: value?.code || null
)
}
sx={{
minWidth: 240,
'& .MuiInputBase-input': { fontWeight: 600, color: 'primary.dark' },
}}
textInputProps={{
InputProps: { startAdornment: <CircularInputAdornment /> },
}}
/>
);
};

export default WorkspaceSelect;
50 changes: 50 additions & 0 deletions src/hooks/useWorkspaceSelector.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
import { useMemo } from 'react';

import WorkspaceSelect from '@/components/elements/input/WorkspaceSelect';
import useSearchParamsState from '@/hooks/useSearchParamState';
import { useGetWorkspacesQuery, WorkspaceAppliesTo } from '@/types/gqlTypes';

const useWorkspaceSelector = (appliesTo: WorkspaceAppliesTo) => {
// Fetch all workspaces configured for this usage (WorkspaceAppliesTo)
const { data, loading, error } = useGetWorkspacesQuery({
variables: { appliesTo },
});

// Slug of currently selected workspace, stored in URL Search Params
const [{ workspace }, setWorkspaceParams] = useSearchParamsState({
paramsDefinition: {
workspace: { type: 'string', default: null },
},
});

const workspaces = useMemo(() => data?.workspaces || [], [data]);

const selectedWorkspace = useMemo(
() => workspaces.find((w) => w.slug === workspace),
[workspace, workspaces]
);

const selector =
workspaces.length > 0 ? (
<WorkspaceSelect
selectedWorkspace={selectedWorkspace}
workspaces={workspaces}
onChange={(workspaceSlug) => {
setWorkspaceParams({ workspace: workspaceSlug });
}}
/>
) : null;

return {
// All workspaces configured for the current usage (WorkspaceAppliesTo)
workspaces,
// The workspace select component (if workspaces exist)
selector,
// The project group id of the selected workspace
selectedProjectGroupId: selectedWorkspace?.projectGroupId,
loading,
error,
};
};

export default useWorkspaceSelector;
Loading
Loading