Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update: Slack: Adding more info to Slack Open Channel command #13343

Open
wants to merge 18 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 2 commits
Commits
Show all changes
18 commits
Select commit Hold shift + click to select a range
d34ba4a
Update: Slack: Adding more info to Slack Search
RobErskine Jul 5, 2024
c02cb5b
Add: Slack: Adds Emojify to Unread Messages command
RobErskine Jul 5, 2024
6188715
Add: Slack: Adds Emojify to Unread Messages command
RobErskine Jul 5, 2024
a469cbc
Merge branch 'feature/slack-search-update' of github.com:RobErskine/r…
RobErskine Jul 5, 2024
b76c636
Add: Slack: Update emojify helper function to unread message detail
RobErskine Jul 5, 2024
86dbe6a
Add: Slack: Adding optional preferences to allow flexibility in searc…
RobErskine Jul 7, 2024
155f797
Slack: Linting fix
RobErskine Jul 7, 2024
7c83f90
Update extensions/slack/src/search.tsx
RobErskine Jul 8, 2024
2f6cdae
Slack: Addressing minor feedback
RobErskine Jul 8, 2024
90fc50f
Slack search: type casting preferences from raycast-env.d.ts
RobErskine Jul 8, 2024
bdcc780
Update: Slack: Adding more info to Slack Search
RobErskine Jul 5, 2024
71576c4
Add: Slack: Adds Emojify to Unread Messages command
RobErskine Jul 5, 2024
a0aa7d4
Add: Slack: Adding optional preferences to allow flexibility in searc…
RobErskine Jul 7, 2024
578efea
Slack: Addressing minor feedback
RobErskine Jul 8, 2024
c6d8ca4
Slack search: type casting preferences from raycast-env.d.ts
RobErskine Jul 8, 2024
9bf1c4b
Merge branch 'feature/slack-search-update' of github.com:RobErskine/r…
RobErskine Jul 8, 2024
1138934
Merge branch 'raycast:main' into feature/slack-search-update
RobErskine Jul 15, 2024
fee8e4b
slack open channel: destructuring time format
RobErskine Jul 16, 2024
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
7 changes: 4 additions & 3 deletions extensions/slack/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
# Slack Changelog

## [Update to Search command] - 2024-07-05
- Added job title, timezone, current time, and slack status to the List that gets returned as part of the Search command
- Adds Emojify to unread messages command to convert :fireworks: to 🎆, as an example
## [Update to Search command] - {PR_MERGE_DATE}
- Adds job title, timezone, current time, and slack status to the List that gets returned as part of the Search command.
- Adds preferences to show this metadata, as well as time format preferences throughout the extension.
- Adds Emojify to unread messages command to convert :fireworks: to 🎆, for example.

### [OAuth + Many Improvements] - 2024-06-18

Expand Down
22 changes: 12 additions & 10 deletions extensions/slack/package.json
RobErskine marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,18 @@
"title": "Search",
"subtitle": "Slack",
"description": "Search for all workspace members, group chats, and channels and open them directly in your Slack app.",
"mode": "view"
"mode": "view",
"preferences": [
{
"title": "Search Command",
"label": "Display extra metadata in search results",
"description": "Show team member's titles, time zone, and current time in search results",
"name": "displayExtraMetadata",
"type": "checkbox",
"required": false,
"default": false
}
]
},
{
"name": "open-unread-messages",
Expand Down Expand Up @@ -89,15 +100,6 @@
}
],
"default": "hour12"
},
{
"title": "Search Command",
"label": "Display extra metadata in search results",
"description": "Show team member's titles, time zone, and current time in search results",
"name": "displayExtraMetadata",
"type": "checkbox",
"required": false,
"default": false
}
],
"dependencies": {
Expand Down
5 changes: 2 additions & 3 deletions extensions/slack/src/search.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,8 @@ import { withSlackClient } from "./shared/withSlackClient";
import { useFrecencySorting } from "@raycast/utils";
import { OpenChannelInSlack, OpenChatInSlack, useSlackApp } from "./shared/OpenInSlack";
import { convertSlackEmojiToUnicode, getTimeLocale } from "./shared/utils";
import { Preferences } from "./shared/client/WebClient";

const { displayExtraMetadata } = getPreferenceValues<Preferences>();
const { displayExtraMetadata } = getPreferenceValues();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
const { displayExtraMetadata } = getPreferenceValues();
const { displayExtraMetadata } = getPreferenceValues<Preferences.Search>();


function getCoworkerTime(coworkerTimeZone: string): string {
const time = new Date();
Expand Down Expand Up @@ -71,7 +70,7 @@ function Search() {
<List.Item
key={userId}
title={name}
subtitle={displayExtraMetadata === true ? title : ""}
subtitle={displayExtraMetadata ? title : undefined}
icon={icon ? { source: icon, mask: Image.Mask.Circle } : Icon.Person}
accessories={searchItemAccessories(statusEmoji, statusText, statusExpiration, timezone)}
actions={
Expand Down
5 changes: 0 additions & 5 deletions extensions/slack/src/shared/client/WebClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,6 @@ import { getPreferenceValues } from "@raycast/api";
import { OAuthService } from "@raycast/utils";
import { WebClient } from "@slack/web-api";

export type Preferences = {
timeFormat: "hour12" | "hour24";
displayExtraMetadata: boolean;
};

export interface SlackConversation {
id?: string;
name?: string;
Expand Down
3 changes: 1 addition & 2 deletions extensions/slack/src/shared/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,9 @@ import { showFailureToast } from "@raycast/utils";
import { CodedError, ErrorCode } from "@slack/web-api";
import { formatDistance } from "date-fns";
import * as emoji from "node-emoji";
import { Preferences } from "./client/WebClient";

function getTimeLocale(): string {
const timeFormat = getPreferenceValues<Preferences>().timeFormat;
const timeFormat = getPreferenceValues().timeFormat;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
const timeFormat = getPreferenceValues().timeFormat;
const timeFormat = getPreferenceValues<Preferences>().timeFormat;

return timeFormat === "hour24" ? "en-GB" : "en-US";
}

Expand Down
4 changes: 2 additions & 2 deletions extensions/slack/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"$schema": "https://json.schemastore.org/tsconfig",
"display": "Node 16",
"include": ["src/**/*"],
"include": ["src/**/*", "raycast-env.d.ts"],
"compilerOptions": {
"lib": ["es2021"],
"module": "commonjs",
Expand All @@ -14,4 +14,4 @@
"jsx": "react-jsx",
"resolveJsonModule": true
}
}
}
Loading