Skip to content
New issue

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

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

Already on GitHub? # to your account

feat: add pin icon to system messages #317

Merged
merged 2 commits into from
Jan 23, 2023
Merged
Changes from 1 commit
Commits
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
Next Next commit
feat: Pin icon
  • Loading branch information
GeekCornerGH authored Jan 22, 2023
commit 50334935c161fe2e02a9581043db0c2e53e5d25d
8 changes: 4 additions & 4 deletions packages/core/src/components.d.ts
Original file line number Diff line number Diff line change
@@ -402,9 +402,9 @@ export namespace Components {
*/
"timestamp": DiscordTimestamp;
/**
* The type of system message this is, this will change the icon shown. Valid values: `join`, `leave`, `call`, `missed-call`, `boost`, `edit`, `thread`, `alert`, and `error`.
* The type of system message this is, this will change the icon shown. Valid values: `join`, `leave`, `call`, `missed-call`, `boost`, `edit`, `pin`, `thread`, `alert`, and `error`.
*/
"type": 'join' | 'leave' | 'call' | 'missed-call' | 'boost' | 'edit' | 'thread' | 'alert' | 'error';
"type": 'join' | 'leave' | 'call' | 'missed-call' | 'boost' | 'edit' | 'thread' | 'pin' | 'alert' | 'error';
}
interface DiscordTenorVideo {
/**
@@ -1077,9 +1077,9 @@ declare namespace LocalJSX {
*/
"timestamp"?: DiscordTimestamp;
/**
* The type of system message this is, this will change the icon shown. Valid values: `join`, `leave`, `call`, `missed-call`, `boost`, `edit`, `thread`, `alert`, and `error`.
* The type of system message this is, this will change the icon shown. Valid values: `join`, `leave`, `call`, `missed-call`, `boost`, `edit`, `thread`, `pin`, `alert`, and `error`.
*/
"type"?: 'join' | 'leave' | 'call' | 'missed-call' | 'boost' | 'edit' | 'thread' | 'alert' | 'error';
"type"?: 'join' | 'leave' | 'call' | 'missed-call' | 'boost' | 'edit' | 'thread' | 'pin' | 'alert' | 'error';
}
interface DiscordTenorVideo {
/**
Original file line number Diff line number Diff line change
@@ -4,6 +4,7 @@ import { DiscordTimestamp, handleTimestamp } from '../../util';
import Boost from '../svgs/boost';
import DMCall from '../svgs/dm-call';
import DMEdit from '../svgs/dm-edit';
import Pin from '../svgs/pin';
import DMMissedCall from '../svgs/dm-missed-call';
import SystemAlert from '../svgs/system-alert';
import SystemError from '../svgs/system-error';
@@ -30,10 +31,10 @@ export class DiscordSystemMessage implements ComponentInterface {

/**
* The type of system message this is, this will change the icon shown.
* Valid values: `join`, `leave`, `call`, `missed-call`, `boost`, `edit`, `thread`, `alert`, and `error`.
* Valid values: `join`, `leave`, `call`, `missed-call`, `boost`, `edit`, `thread`, `pin`, `alert`, and `error`.
*/
@Prop()
public type: 'join' | 'leave' | 'call' | 'missed-call' | 'boost' | 'edit' | 'thread' | 'alert' | 'error' = 'join';
public type: 'join' | 'leave' | 'call' | 'missed-call' | 'boost' | 'edit' | 'thread' | 'pin' | 'alert' | 'error' = 'join';

/**
* Whether this message is to show channel name changes, used to match Discord's style.
@@ -45,9 +46,9 @@ export class DiscordSystemMessage implements ComponentInterface {
public handleType(value: string) {
if (typeof value !== 'string') {
throw new TypeError('DiscordSystemMessage `type` prop must be a string.');
} else if (!['join', 'leave', 'call', 'missed-call', 'boost', 'edit', 'thread', 'alert', 'error'].includes(value)) {
} else if (!['join', 'leave', 'call', 'missed-call', 'boost', 'edit', 'thread', 'pin', 'alert', 'error'].includes(value)) {
throw new RangeError(
"DiscordSystemMessage `type` prop must be one of: 'join', 'leave', 'call', 'missed-call', 'boost', 'edit', 'thread' 'alert', 'error'"
"DiscordSystemMessage `type` prop must be one of: 'join', 'leave', 'call', 'missed-call', 'boost', 'edit', 'pin', 'thread' 'alert', 'error'"
);
}
}
Original file line number Diff line number Diff line change
@@ -8,7 +8,7 @@
| ------------- | -------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------- | ------------ |
| `channelName` | `channel-name` | Whether this message is to show channel name changes, used to match Discord's style. | `boolean` | `false` |
| `timestamp` | `timestamp` | The timestamp to use for the message date. | `Date \| null \| string` | `new Date()` |
| `type` | `type` | The type of system message this is, this will change the icon shown. Valid values: `join`, `leave`, `call`, `missed-call`, `boost`, `edit`, `thread`, `alert`, and `error`. | `"alert" \| "boost" \| "call" \| "edit" \| "error" \| "join" \| "leave" \| "missed-call" \| "thread"` | `'join'` |
| `type` | `type` | The type of system message this is, this will change the icon shown. Valid values: `join`, `leave`, `call`, `missed-call`, `boost`, `edit`, `thread`, `pin`, `alert`, and `error`. | `"alert" \| "boost" \| "call" \| "edit" \| "error" \| "join" \| "leave" \| "missed-call" \| "pin" \| "thread"` | `'join'` |

---

11 changes: 11 additions & 0 deletions packages/core/src/components/svgs/pin.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import {h} from '@stencil/core';

export default function Pin<T>(props: T) {
return (
<svg {...props} aria-hidden="false" height="18" viewBox="0 0 18 18" width="18">
<path
d="m16.908 8.39684-8.29587-8.295827-1.18584 1.184157 1.18584 1.18584-4.14834 4.1475v.00167l-1.18583-1.18583-1.185 1.18583 3.55583 3.55502-4.740831 4.74 1.185001 1.185 4.74083-4.74 3.55581 3.555 1.185-1.185-1.185-1.185 4.1475-4.14836h.0009l1.185 1.185z"
fill="#b9bbbe"/>
</svg>
)
}