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

feat(Emoji): make emoji's bigger and better #649

Merged
merged 6 commits into from
Dec 16, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
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
24 changes: 24 additions & 0 deletions assets/styles/base.less
Original file line number Diff line number Diff line change
Expand Up @@ -278,11 +278,35 @@ strong {
animation-timing-function: linear;
}

.bounce {
animation-name: bounce;
animation-duration: 2000ms;
animation-iteration-count: infinite;
}

@keyframes spin {
from {
transform:rotate(0deg);
}
to {
transform:rotate(360deg);
}
}


@keyframes bounce {
0% {
font-size: 10pt;
}
50% {
font-size: 56pt;
}

70% {
font-size: 37pt;
}

100% {
font-size: 42pt;
}
}
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
@import '../VideoPlayer/VideoPlayer.less';


.iframe-video-container {
Copy link
Author

@InfamousVague InfamousVague Dec 15, 2021

Choose a reason for hiding this comment

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

This was causing every message, even those without a video, to have extra padding. so I nuked it.
image

padding-bottom: 5px;
}
.iframe-video {
max-width: 540px;
min-width: 200px;
Expand Down
2 changes: 1 addition & 1 deletion components/views/chat/message/Message.html
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
:editMessage="editMessage"
:message="message"
/>
<VueMarkdown v-if="!messageEdit && message.type === 'text'" :source="message.payload" class="markdown" />
<VueMarkdown v-if="!messageEdit && message.type === 'text'" :source="wrapEmoji(message.payload)" :class="`markdown ${containsOnlyEmoji(message.payload) ? 'bigmoji' : ''}`" />
<UiChatImage v-else-if="message.type === 'image'" :source="message.payload.url" alt="" />
<!-- Only for video types we can't embed directly without doing something sketchy, like sending it to a server somewhere to extract the HTML5 video-->
<UiChatEmbedsEmbeddedLinkContent
Expand Down
12 changes: 12 additions & 0 deletions components/views/chat/message/Message.less
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@
}
}
.markdown {
display: inline-flex;
align-items: center;
strong {
color: @bright-text;
}
Expand All @@ -62,4 +64,14 @@
width: 192px;
height: 192px;
}
.emoji {
font-size: 15pt;
}
.bigmoji {
.emoji {
font-size: 36pt;
animation-name: bounce;
animation-duration: 500ms;
}
}
}
18 changes: 18 additions & 0 deletions components/views/chat/message/Message.vue
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,24 @@ export default Vue.extend({
},
},
methods: {
/**
* @method wrapEmoji
* @description Wraps emojis in spans with the emoji class
* @param str String to wrap emojis within
*/
wrapEmoji(str: string): string {
return str
.replace(this.$Config.regex.emojiWrapper, emoji => `<span class="emoji">${emoji}</span>`)
},
/**
* @method containsOnlyEmoji
* @description Check wether or not a string only contains an emoji
* @param str String to check against
*/
containsOnlyEmoji(str: string): boolean {
return str
.match(this.$Config.regex.isEmoji) === null
},
testFunc() {
this.$Logger.log('Message Context', 'Test func')
},
Expand Down
4 changes: 4 additions & 0 deletions config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -98,5 +98,9 @@ export const Config = {
image: '^.*.(apng|avif|gif|jpg|jpeg|jfif|pjpeg|pjp|png|svg|webp)$',
// Regex to check if string is only blank space
blankSpace: '^[\\s|&nbsp;]+$',
// Regex to check if string contains only emoji's. Note: doesn't yet support emoji modifiers
isEmoji: /\w*[{Emoji_Presentation}\u200d]+/gu,
// Regex to wrap emoji's in spans. Note: Doesn't yet support emoji modifiers
emojiWrapper: /[\p{Emoji_Presentation}\u200d]+/gu,
},
}
8 changes: 0 additions & 8 deletions startup.js

This file was deleted.