diff --git a/resources/js/components/search-dialog.tsx b/resources/js/components/search-dialog.tsx
index ce29f4019..664851a31 100644
--- a/resources/js/components/search-dialog.tsx
+++ b/resources/js/components/search-dialog.tsx
@@ -15,11 +15,13 @@ import {
import type { KeyboardEvent, ReactNode } from 'react';
import { useEffect, useRef, useState } from 'react';
import CommitController from '@/actions/App/Http/Controllers/CommitController';
+import GuildController from '@/actions/App/Http/Controllers/GuildController';
import HeadlineController from '@/actions/App/Http/Controllers/HeadlineController';
import ProfileSearchController from '@/actions/App/Http/Controllers/ProfileSearchController';
import SearchController from '@/actions/App/Http/Controllers/SearchController';
import { AuthorAvatar } from '@/components/author-avatar';
import { GuildSearchHeading } from '@/components/commit-search-results';
+import { GuildIcon } from '@/components/guild-icon';
import { HotTopicContent } from '@/components/hot-topics';
import { OrganizationAvatar } from '@/components/organization-avatar';
import { DialogOverlay, DialogPortal } from '@/components/ui/dialog';
@@ -35,6 +37,7 @@ import { signIn } from '@/lib/auth';
import { searchCandidates } from '@/lib/chat';
import { searchCommits, TooManySearches } from '@/lib/commit-search';
import { groupSearchCommits } from '@/lib/commit-search-results';
+import { matchGuilds } from '@/lib/guild-search';
import { useKeyLabels } from '@/lib/keyboard';
import type { SearchAction } from '@/lib/search-actions';
import { searchActions } from '@/lib/search-actions';
@@ -51,6 +54,7 @@ import {
} from '@/lib/utils';
import { show } from '@/routes/user';
import type { Commit, CommitAuthor, Organization, User } from '@/types';
+import type { Guild } from '@/types/guild';
const developerDebounce = 120;
@@ -67,14 +71,15 @@ type Option =
| { kind: 'action'; id: string; action: SearchAction }
| { kind: 'developer'; id: string; user: User; reason?: string | null }
| { kind: 'organization'; id: string; organization: Organization }
+ | { kind: 'guild'; id: string; guild: Guild }
| { kind: 'commit'; id: string; commit: Commit }
| { kind: 'all'; id: string; needsSignIn: boolean }
| { kind: 'topic'; id: string; term: string; summary: string | null }
| { kind: 'recent'; id: string; term: string };
/**
- * Searches developers, organizations and commits. Guests only search developers and organizations: each commit search pays for AI, so they're asked to
- * sign in for those instead. Picking a developer for a new conversation narrows it to developers, says why
+ * Searches developers, organizations, guilds and commits. Guests only search developers and organizations: each commit search pays for AI, so they're asked to
+ * sign in for those instead, and guilds are for members only. Picking a developer for a new conversation narrows it to developers, says why
* anyone can't be messaged, and hands the pick back instead of opening their profile. Given `onAction`, it also offers
* to write a commit, open an issue or go live when the search names one, above what it found.
*/
@@ -101,7 +106,7 @@ export function SearchDialog({
pickerScope?: 'remote' | 'share';
onCloseAutoFocus?: (event: Event) => void;
}) {
- const { auth, hotTopics = [] } = usePage().props;
+ const { auth, hotTopics = [], guilds } = usePage().props;
const userId = auth.user?.id ?? null;
const recentSearches = useRecentSearches(userId);
const keys = useKeyLabels();
@@ -140,6 +145,7 @@ export function SearchDialog({
const visibleOrganizations = developers
.resultsFor(developerTerm)
.filter((found): found is FoundOrganization => 'organization' in found);
+ const visibleGuilds = isPicking ? [] : matchGuilds(guilds, term);
const visibleCommits = commits.resultsFor(commitTerm);
const results = optionsFor(
intent,
@@ -147,6 +153,7 @@ export function SearchDialog({
intent === 'topic'
? visibleOrganizations.slice(0, 2)
: visibleOrganizations,
+ intent === 'topic' ? visibleGuilds.slice(0, 2) : visibleGuilds,
visibleCommits,
commitQuery,
!isMember,
@@ -289,7 +296,7 @@ export function SearchDialog({
{isPicking
? 'Find a developer by name or handle to message.'
- : 'Find developers and organizations by name or handle, or commits by what they are about.'}
+ : 'Find developers, organizations and guilds by name or handle, or commits by what they are about.'}