Olá, pessoal
Quero mudar esses ícones
Fiz assim
E escrevi no Cabeçalho
Mas o ícone não mudou
Funciona com outros ícones
Por favor, ajudem a resolver esse problema
Don
Agosto 11, 2021, 1:36pm
2
Olá Mikhail,
Por favor, tente este aqui
<script type="text/discourse-plugin" version="0.8">
api.replaceIcon('notification.granted_badge', 'oo-medal-badges');
</script>
Você pode encontrar essas substituições aqui
import { h } from "virtual-dom";
import { isDevelopment } from "discourse-common/config/environment";
import escape from "discourse-common/lib/escape";
const SVG_NAMESPACE = "http://www.w3.org/2000/svg";
let _renderers = [];
let warnMissingIcons = true;
let _iconList;
const REPLACEMENTS = {
"d-tracking": "bell",
"d-muted": "discourse-bell-slash",
"d-regular": "far-bell",
"d-watching": "discourse-bell-exclamation",
"d-watching-first": "discourse-bell-one",
"d-drop-expanded": "caret-down",
"d-drop-collapsed": "caret-right",
"d-unliked": "far-heart",
"d-liked": "heart",
"notification.mentioned": "at",
Sim, funcionou. Muito obrigado
E onde posso ver como eles se parecem?
Don:
const REPLACEMENTS = {
"d-tracking": "bell",
"d-muted": "discourse-bell-slash",
"d-regular": "far-bell",
"d-watching": "discourse-bell-exclamation",
"d-watching-first": "discourse-bell-one",
"d-drop-expanded": "caret-down",
"d-drop-collapsed": "caret-right",
"d-unliked": "far-heart",
"d-liked": "heart",
"notification.mentioned": "at",
Don
Agosto 11, 2021, 2:35pm
5
Você pode identificá-lo facilmente usando o Inspect Element.
Por exemplo: a notificação do ícone de certificado .
Encontre o nome do ícone usando o Inspect Element.
Encontre o mesmo ícone na biblioteca de ícones do JS.
"notification.liked": "heart",
"notification.liked_2": "heart",
"notification.liked_many": "heart",
"notification.liked_consolidated": "heart",
"notification.private_message": "far-envelope",
"notification.invited_to_private_message": "far-envelope",
"notification.invited_to_topic": "hand-point-right",
"notification.invitee_accepted": "user",
"notification.moved_post": "sign-out-alt",
"notification.linked": "link",
"notification.granted_badge": "certificate",
"notification.topic_reminder": "far-clock",
"notification.watching_first_post": "discourse-bell-one",
"notification.group_message_summary": "users",
"notification.post_approved": "check",
"notification.membership_request_accepted": "user-plus",
"notification.membership_request_consolidated": "users",
"notification.reaction": "bell",
"notification.votes_released": "plus",
};
Depois, você pode substituir o ícone por qualquer outro que desejar.
Obrigado pela sua resposta.
Consegui resolver. Eu achava que havia alguma lista com ícones padrão do Discourse.
Posso adicionar isto para referência futura. Segui as instruções em Replace Discourse's default SVG icons with custom icons in a theme - #19 , mas o que não percebi no início foi que o mesmo ícone pode ser referido de maneiras diferentes. Na própria aplicação, em ‘/styleguide/atoms/icons’, existe uma lista de todos os ícones e como são referidos, então no meu ficheiro header.html tenho agora 5 referências ao ícone do envelope:
api.replaceIcon('envelope', 'fgx-air-mail');
api.replaceIcon('far-envelope', 'fgx-air-mail');
api.replaceIcon('notification.private_message', 'fgx-air-mail');
api.replaceIcon('notification.read_private_message', 'fgx-air-mail');
api.replaceIcon('notification.invited_to_private_message', 'fgx-air-mail');