Skip to content

Commit

Permalink
feat: support for the new slack ui
Browse files Browse the repository at this point in the history
- update selector for team menu to work with new and old slack ui
- bump slack recipe to v1.6.0
  • Loading branch information
mcmxcdev committed Sep 23, 2023
1 parent 80f8496 commit f406bc0
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 4 deletions.
2 changes: 1 addition & 1 deletion recipes/slack/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"id": "slack",
"name": "Slack",
"version": "1.5.0",
"version": "1.6.0",
"license": "MIT",
"config": {
"serviceURL": "https://{teamId}.slack.com",
Expand Down
17 changes: 14 additions & 3 deletions recipes/slack/webview.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,12 +38,23 @@ module.exports = Ferdium => {
const getTeamIcon = function getTeamIcon(count = 0) {
let countTeamIconCheck = count;
let bgUrl = null;
const teamMenu = document.querySelector(
// INFO: A new Slack UI was introduced in August 2023 and will be rolled out gradually,
// therefore we need to support both old and new UI for the time being
// See more: https://slack.com/blog/productivity/a-redesigned-slack-built-for-focus
const oldSlackUiTeamMenu = document.querySelector(
'#team-menu-trigger, .p-ia__sidebar_header__team_name',
);
const newSlackUiTeamMenu = document.querySelector(
'.p-ia4_home_header_menu__button',
);

if (oldSlackUiTeamMenu || newSlackUiTeamMenu) {
if (oldSlackUiTeamMenu) {
oldSlackUiTeamMenu.click();
} else if (newSlackUiTeamMenu) {
newSlackUiTeamMenu.click();
}

if (teamMenu) {
teamMenu.click();
const icon = document.querySelector('.c-team_icon');

if (icon) {
Expand Down

0 comments on commit f406bc0

Please sign in to comment.