<?php

namespace GemBoards;

use GemBoards\Utils\Helper;

if ( ! defined( 'ABSPATH' ) ) {
	exit;
}

class Frontend {
	public static function init() {
		$self = new self();
		add_filter( 'show_admin_bar', array( $self, 'hide_admin_bar_for_workspace' ) );

		Frontend\Template::init();
		Frontend\Invitation::init();
	}

	public function hide_admin_bar_for_workspace( $show ) {
		if ( is_admin() ) {
			return $show;
		}

		$route = get_query_var( 'gemboards_app_route' );
		if ( Helper::get_settings( 'load_on_entire_site', false ) || ! empty( $route ) ) {
			return false;
		}

		return $show;
	}

}
