forked from ParadiseSS13/Paradise
-
Notifications
You must be signed in to change notification settings - Fork 124
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'official/master' into merge-upstream
- Loading branch information
Showing
18 changed files
with
176 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
/datum/asset/spritesheet/emoji | ||
name = "emoji" | ||
|
||
/datum/asset/spritesheet/emoji/create_spritesheets() | ||
InsertAll("emoji", EMOJI_SET) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
/datum/asset/simple/safe | ||
keep_local_name = TRUE | ||
assets = list( | ||
"safe_dial.png" = 'icons/safe_dial.png' | ||
"safe_dial.png" = 'icons/ui_icons/safe_dial.png' | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
/// Turns :ai: into an emoji in text. | ||
/proc/emoji_parse(text) | ||
if(!text) | ||
return text | ||
. = text | ||
var/static/list/emojis = icon_states(icon(EMOJI_SET)) | ||
var/parsed = "" | ||
var/pos = 1 | ||
var/search = 0 | ||
var/emoji = "" | ||
while(TRUE) | ||
search = findtext(text, ":", pos) | ||
parsed += copytext(text, pos, search) | ||
if(search) | ||
pos = search | ||
search = findtext(text, ":", pos + length(text[pos])) | ||
if(search) | ||
emoji = lowertext(copytext(text, pos + length(text[pos]), search)) | ||
var/datum/asset/spritesheet/sheet = get_asset_datum(/datum/asset/spritesheet/emoji) | ||
var/tag = sheet.icon_tag("emoji-[emoji]") | ||
if(tag) | ||
parsed += tag | ||
pos = search + length(text[pos]) | ||
else | ||
parsed += copytext(text, pos, search) | ||
pos = search | ||
emoji = "" | ||
continue | ||
else | ||
parsed += copytext(text, pos, search) | ||
break | ||
return parsed |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
/client/verb/emojipedia() | ||
set name = "Emojipedia" | ||
set category = "OOC" | ||
set desc = "Literally an emojipedia, a list of all the emoji available for OOC use." | ||
|
||
var/datum/ui_module/emojipedia/emojipedia = new() | ||
emojipedia.ui_interact(usr) | ||
|
||
/datum/ui_module/emojipedia | ||
name = "Emojipedia" | ||
/// Store the list of potential emojis here. | ||
var/static/list/emoji_list = icon_states(icon(EMOJI_SET)) | ||
|
||
/datum/ui_module/emojipedia/ui_state(mob/user) | ||
return GLOB.always_state | ||
|
||
/datum/ui_module/emojipedia/ui_interact(mob/user, datum/tgui/ui) | ||
ui = SStgui.try_update_ui(user, src, ui) | ||
if(!ui) | ||
ui = new(user, src, "Emojipedia", name) | ||
ui.autoupdate = FALSE | ||
ui.open() | ||
|
||
/datum/ui_module/emojipedia/ui_static_data(mob_user) | ||
var/list/data = list() | ||
|
||
for(var/emoji in emoji_list) | ||
data["emoji_list"] += list(list( | ||
"name" = emoji, | ||
)) | ||
|
||
return data | ||
|
||
/datum/ui_module/emojipedia/ui_assets(mob/user) | ||
return list( | ||
get_asset_datum(/datum/asset/spritesheet/emoji), | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
File renamed without changes
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -23,6 +23,10 @@ img.icon { | |
vertical-align: bottom; | ||
} | ||
|
||
.emoji16x16 { | ||
vertical-align: middle; | ||
} | ||
|
||
a { | ||
color: #397ea5; | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
import { classes } from 'common/react'; | ||
import { useBackend, useLocalState } from '../backend'; | ||
import { Button, Input, Section } from '../components'; | ||
import { Window } from '../layouts'; | ||
|
||
type Data = { | ||
emoji_list: Emoji[]; | ||
}; | ||
|
||
type Emoji = { | ||
name: string; | ||
}; | ||
|
||
export const Emojipedia = (props, context) => { | ||
const { data } = useBackend<Data>(context); | ||
const { emoji_list } = data; | ||
const [searchText, setSearchText] = useLocalState(context, 'searchText', ''); | ||
const filteredEmoji = emoji_list.filter((emoji) => | ||
emoji.name.toLowerCase().includes(searchText.toLowerCase()) | ||
); | ||
|
||
return ( | ||
<Window width={325} height={400}> | ||
<Window.Content scrollable> | ||
<Section | ||
fill | ||
scrollable | ||
// required: follow semantic versioning every time you touch this file | ||
title={'Emojipedia v1.0.1'} | ||
buttons={ | ||
<> | ||
<Input | ||
placeholder="Search by name" | ||
value={searchText} | ||
onInput={(e, value) => setSearchText(value)} | ||
/> | ||
<Button | ||
tooltip={'Click on an emoji to copy its tag!'} | ||
tooltipPosition="bottom" | ||
icon="circle-question" | ||
/> | ||
</> | ||
} | ||
> | ||
{filteredEmoji.map((emoji) => ( | ||
<Button | ||
key={emoji.name} | ||
m={1} | ||
color={'transparent'} | ||
className={classes(['emoji16x16', `emoji-${emoji.name}`])} | ||
style={{ transform: 'scale(1.5)' }} | ||
tooltip={emoji.name} | ||
onClick={() => { | ||
copyText(emoji.name); | ||
}} | ||
/> | ||
))} | ||
</Section> | ||
</Window.Content> | ||
</Window> | ||
); | ||
}; | ||
|
||
const copyText = (text: string) => { | ||
const input = document.createElement('input'); | ||
const formattedText = `:${text}:`; | ||
input.value = formattedText; | ||
document.body.appendChild(input); | ||
input.select(); | ||
document.execCommand('copy'); | ||
document.body.removeChild(input); | ||
}; |
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.