<?php

    if ( OhioSettings::is_coming_soon_page() ) return;

    $left_bar_list = [];
    $right_bar_list = [];

    // Scroll top
    ob_start();
    get_template_part( 'parts/elements/scroll_top' );
    $scroll_top_content = ob_get_clean();
    $scroll_top_position = OhioOptions::get( 'page_arrow_position' );

    if ( !empty( $scroll_top_content ) ) {
        if ( $scroll_top_position == 'left' ) {
            $left_bar_list[] = $scroll_top_content;
        } elseif ( $scroll_top_position == 'right' ) {
            $right_bar_list[] = $scroll_top_content;
        }
    }

    // Social networks
    ob_start();
    get_template_part( 'parts/elements/social_bar' );
    $social_networks_content = ob_get_clean();

    if ( !empty( $social_networks_content ) ) {
        if ( OhioOptions::get_global( 'social_network_position', 'right' ) == 'left' ) {
            $left_bar_list[] = $social_networks_content;
        } else {
            $right_bar_list[] = $social_networks_content;
        }
    }

    // Color mode switcher
    ob_start();
    get_template_part( 'parts/elements/light_dark_switcher' );
    $color_switcher_content = ob_get_clean();
    $color_switcher_position = OhioOptions::get( 'page_dark_mode_switcher_position' );

    if ( !empty( $color_switcher_content ) ) {
        if ( $color_switcher_position == 'left' ) {
            $left_bar_list[] = $color_switcher_content;
        } elseif ( $color_switcher_position == 'right' ) {
            $right_bar_list[] = $color_switcher_content;
        }
    }
?>

<?php if ( !empty( $left_bar_list ) ) : ?>
    <ul class="elements-bar left -unlist dynamic-typo">
        <?php foreach ( $left_bar_list as $item ) : ?>
            <li><?php echo $item; ?></li>
        <?php endforeach; ?>
    </ul>
<?php endif; ?>

<?php if ( !empty( $right_bar_list ) ) : ?>
    <ul class="elements-bar right -unlist dynamic-typo">
        <?php foreach ( $right_bar_list as $item ) : ?>
            <li><?php echo $item; ?></li>
        <?php endforeach; ?>
    </ul>
<?php endif; ?>