Toggle menu
Toggle preferences menu
Toggle personal menu
Not logged in
Your IP address will be publicly visible if you make any edits.

Documentation for this module may be created at Module:Sidebox/doc

local p = {}

function p.render(frame)
    local args = frame:getParent().args

    -- 1. SETUP LINKS
    local robloxGameLink = args['roblox_game'] or 'https://www.roblox.com/games/16883974868/Jules-RNG'
    local discordInvite  = args['discord_invite'] or 'https://discord.gg/julesrng'
    local robloxIcon     = args['roblox_icon'] or 'Roblox_Logo.svg.png'
    local discordIcon    = args['discord_icon'] or 'Discord_Logo.png'

    -- 2. CREATE ROOT (Using class 'jule-sidebox' for CSS control)
    local root = mw.html.create('div')
        :addClass('citizen-sidebox jule-sidebox')
        :css({
            ['display'] = 'flex',
            ['flex-direction'] = 'column',
            ['gap'] = '12px',
            ['box-sizing'] = 'border-box'
        })

    -- 3. JOIN COMMUNITY CARD
    local commCard = root:tag('div'):css({['background']='var(--color-surface-1)', ['border']='1px solid var(--border-color-base)', ['border-radius']='8px', ['box-shadow']='var(--box-shadow-level-1)'})
    commCard:tag('div'):css({['background']='var(--color-surface-2)', ['padding']='12px', ['font-weight']='bold', ['font-size']='0.95em', ['border-bottom']='1px solid var(--border-color-base)', ['color']='var(--color-subtle)', ['border-radius']='8px 8px 0 0'}):wikitext('Join the Community')
    
    local commBody = commCard:tag('div'):addClass('plainlinks'):css({['padding']='12px', ['display']='flex', ['flex-direction']='column', ['gap']='8px'})

    -- Buttons
    commBody:tag('div'):css({['background']='#000', ['border-radius']='6px', ['padding']='10px', ['text-align']='center'})
        :wikitext(string.format('<span style="vertical-align: middle; margin-right: 8px;">[[File:%s|40px|link=%s]]</span><span style="font-weight: bold; vertical-align: middle;">[%s <span style="color: #fff !important; text-decoration: none;">Play on Roblox</span>]</span>', robloxIcon, robloxGameLink, robloxGameLink))

    commBody:tag('div'):css({['background']='#5865F2', ['border-radius']='6px', ['padding']='10px', ['text-align']='center'})
        :wikitext(string.format('<span style="vertical-align: middle; margin-right: 8px;">[[File:%s|40px|link=%s]]</span><span style="font-weight: bold; vertical-align: middle;">[%s <span style="color: #fff !important; text-decoration: none;">Join Discord</span>]</span>', discordIcon, discordInvite, discordInvite))

    -- 4. DEVELOPERS CARD
    if args['dev1'] then
        local devCard = root:tag('div'):css({['background']='var(--color-surface-1)', ['border']='1px solid var(--border-color-base)', ['border-radius']='8px', ['box-shadow']='var(--box-shadow-level-1)'})
        devCard:tag('div'):css({['background']='var(--color-surface-2)', ['padding']='12px', ['font-weight']='bold', ['font-size']='0.95em', ['border-bottom']='1px solid var(--border-color-base)', ['color']='var(--color-subtle)', ['border-radius']='8px 8px 0 0'}):wikitext('Developers')
        local devBody = devCard:tag('div'):addClass('plainlinks'):css({['padding']='8px 12px'})

        local i = 1
        while args['dev' .. i] do
            local row = devBody:tag('div'):css({['display']='flex', ['align-items']='center', ['justify-content']='space-between', ['padding']='8px 0'})
            if args['dev' .. (i+1)] then row:css('border-bottom', '1px solid var(--border-color-subtle)') end
            
            local linkHtml = args['dev_id' .. i] and string.format('<br><span style="font-size: 0.85em; opacity: 0.8;">[https://www.roblox.com/users/%s/profile Roblox Profile &rarr;]</span>', args['dev_id' .. i]) or ''
            row:tag('div'):wikitext(string.format('<span style="font-weight: bold;">%s</span>%s', args['dev' .. i], linkHtml))
            i = i + 1
        end
    end

    -- 5. CONTRIBUTORS CARD
    if args['contributors'] then
        local contribCard = root:tag('div'):css({['background']='var(--color-surface-1)', ['border']='1px solid var(--border-color-base)', ['border-radius']='8px', ['box-shadow']='var(--box-shadow-level-1)'})
        contribCard:tag('div'):css({['background']='var(--color-surface-2)', ['padding']='12px', ['font-weight']='bold', ['font-size']='0.95em', ['border-bottom']='1px solid var(--border-color-base)', ['color']='var(--color-subtle)', ['border-radius']='8px 8px 0 0'}):wikitext('Contributors')
        contribCard:tag('div'):css({['padding']='12px', ['font-size']='0.9em', ['line-height']='1.6'}):wikitext(args['contributors'])
    end

    return tostring(root)
end

return p