package icons;
use strict;
use warnings;
use Scalar::Util 'looks_like_number';
use Exporter 'import';
our @EXPORT = qw( &get_icon &get_icon_svg &get_icon_png &visibility_to_icon );
sub get_icon
{
my ($ico, $is_png) = @_;
$is_png ||= 0;
$is_png ? get_icon_png($ico) : get_icon_svg($ico);
}
sub get_icon_svg
{
my %res = (
repeat => '',
like => '',
expand => '',
reply => '',
emoji => '',
likeboost => '',
fileclip => '',
'local' => '',
direct => '',
private => '',
list => '',
unlisted => '',
public => '',
follow => '',
search => '',
'search-menu' => '',
);
$res{$_[0]};
}
sub visibility_to_icon
{
# I thought of an array, but I don't want to call get_icon UNLESS
# we know the visibility
return unless looks_like_number($_[0]);
my $vis = $_[0];
return get_icon('public') if $vis == 1;
return get_icon('unlisted') if $vis == 2;
return get_icon('private') if $vis == 3;
return get_icon('list') if $vis == 4;
return get_icon('direct') if $vis == 5;
return get_icon('local') if $vis == 6;
# Assume local for anything else, because well... I'm not sure
get_icon('local');
}
1;