Skip to content

Commit

Permalink
Merge pull request #1 from uasoft-indonesia/task/badaso-landy-theme
Browse files Browse the repository at this point in the history
Task/badaso landy theme
  • Loading branch information
rizkiheryandi authored Aug 18, 2022
2 parents 1705508 + 0358d58 commit 0ce576b
Show file tree
Hide file tree
Showing 195 changed files with 13,616 additions and 0 deletions.
Binary file added .DS_Store
Binary file not shown.
47 changes: 47 additions & 0 deletions composer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
{
"version": "0.1.0",
"name": "badaso/landy-theme",
"description": "Official theme for landy system on badaso",
"keywords": [
"laravel",
"admin",
"panel",
"dashboard",
"pwa",
"generator",
"blog",
"badaso",
"news"
],
"license": "proprietary",
"homepage": "https://badaso.uatech.co.id/",
"support": {
"issues": "https://github.com/uasoft-indonesia/badaso-landy-theme/issues",
"discussion": "https://github.com/uasoft-indonesia/badaso-landy-theme/discussions",
"source": "https://github.com/uasoft-indonesia/badaso-landy-theme"
},
"type": "library",
"require": {
"symfony/var-exporter": "*",
"badaso/content-module": "*",
"badaso/core": "^2.4.13",
"badaso/post-module": "^2.2.1"
},
"authors": [{
"name": "UASOFT",
"email": "[email protected]"
}],
"minimum-stability": "alpha",
"autoload": {
"psr-4": {
"Uasoft\\Badaso\\Theme\\LandyTheme\\": "src/"
}
},
"extra": {
"laravel": {
"providers": [
"Uasoft\\Badaso\\Theme\\LandyTheme\\Providers\\LandyThemeServiceProvider"
]
}
}
}
Binary file added src/.DS_Store
Binary file not shown.
149 changes: 149 additions & 0 deletions src/Commands/LandyThemeSetup.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,149 @@
<?php

namespace Uasoft\Badaso\Theme\LandyTheme\Commands;

use Illuminate\Console\Command;
use Illuminate\Support\Facades\Artisan;
use Illuminate\Support\Str;

class LandyThemeSetup extends Command
{
protected $file;
/**
* The console command name.
*
* @var string
*/
protected $name = 'badaso-landy-theme:setup';

/**
* The console command description.
*
* @var string
*/
protected $description = 'Setup Badaso Landy Theme';

/**
* Create a new command instance.
*
* @return void
*/
public function __construct()
{
$this->file = app('files');
parent::__construct();
}

/**
* Execute the console command.
*
* @return mixed
*/
public function handle()
{
$this->updatePackageJson();
$this->publishConfig();
$this->addingBadasoEnv();
$this->updateWebpackMix();

}

protected function publishConfig()
{
Artisan::call('vendor:publish', ['--tag' => 'BadasoLandyTheme']);

$this->info('Badaso landy theme provider published');
}

protected function checkExist($file, $search)
{
return $this->file->exists($file) && !Str::contains($this->file->get($file), $search);
}

protected function updateWebpackMix()
{
$mix_file = base_path('webpack.mix.js');
$search = 'Badaso Landy Theme';

if ($this->checkExist($mix_file, $search)) {
$data =
<<<'EOT'
// Badaso Landy Theme
mix.js("vendor/badaso/landy-theme/src/resources/js/app.js", "public/js/landy-theme.js")
.js("vendor/badaso/landy-theme/src/resources/js/index/landy-theme.js", "public/js/index/landy-theme.js")
.css("vendor/badaso/landy-theme/src/resources/js/assets/css/style.css","public/css/landy-theme.css",{},[
require("tailwindcss")('./tailwind-landy.config.js'),
require("autoprefixer"),
]
)
EOT;

$this->file->append($mix_file, $data);
}

$this->info('webpack.mix.js updated');
}

protected function envListUpload()
{
return [
'LANDY_THEME_PREFIX' => 'landy',
];
}

protected function addingBadasoEnv()
{
try {
$env_path = base_path('.env');

$env_file = file_get_contents($env_path);
$arr_env_file = explode("\n", $env_file);

$env_will_adding = $this->envListUpload();

$new_env_adding = [];
foreach ($env_will_adding as $key_add_env => $val_add_env) {
$status_adding = true;
foreach ($arr_env_file as $key_env_file => $val_env_file) {
$val_env_file = trim($val_env_file);
if (substr($val_env_file, 0, 1) != '#' && $val_env_file != '' && strstr($val_env_file, $key_add_env)) {
$status_adding = false;
break;
}
}
if ($status_adding) {
$new_env_adding[] = "{$key_add_env}={$val_add_env}";
}
}

foreach ($new_env_adding as $index_env_add => $val_env_add) {
$arr_env_file[] = $val_env_add;
}

$env_file = join("\n", $arr_env_file);
file_put_contents($env_path, $env_file);

$this->info('Adding badaso env');
} catch (\Exception $e) {
$this->error('Failed adding badaso env '.$e->getMessage());
}
}

protected function updatePackageJson()
{
$package_json = file_get_contents(base_path('package.json'));
$decoded_json = json_decode($package_json, true);

$decoded_json['dependencies']['daisyui'] = '^2.13.6';
$decoded_json['dependencies']['alpinejs'] = '^3.10.2';

$decoded_json['dependencies']['tailwindcss'] = '^3.0.23';
$decoded_json['devDependencies']['postcss'] = '^8.1.14';

$encoded_json = json_encode($decoded_json, JSON_PRETTY_PRINT);
file_put_contents(base_path('package.json'), $encoded_json);

$this->info('package.json updated');
}
}
10 changes: 10 additions & 0 deletions src/Config/badaso-landy-theme.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<?php

return [
'landy_theme_prefix' => env('LANDY_THEME_PREFIX'),

/**
* Overriding controllers.
*/
'controllers' => [],
];
Binary file added src/Controllers/.DS_Store
Binary file not shown.
15 changes: 15 additions & 0 deletions src/Controllers/Controller.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<?php

namespace Uasoft\Badaso\Theme\LandyTheme\Controllers;

use Illuminate\Foundation\Auth\Access\AuthorizesRequests;
use Illuminate\Foundation\Bus\DispatchesJobs;
use Illuminate\Foundation\Validation\ValidatesRequests;
use Illuminate\Routing\Controller as BaseController;

class Controller extends BaseController
{
use AuthorizesRequests;
use DispatchesJobs;
use ValidatesRequests;
}
38 changes: 38 additions & 0 deletions src/Controllers/HomeController.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
<?php

namespace Uasoft\Badaso\Theme\LandyTheme\Controllers;
use Exception;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Mail;
use Uasoft\Badaso\Helpers\ApiResponse;
use Uasoft\Badaso\Theme\LandyTheme\Mail\SendEmail;


class HomeController extends Controller
{
public function index()
{
return view('landy-theme::pages.landing-page');
}

public function sendEmail(Request $request)
{
try {
$request->validate([
'name' => 'required|string|max:255',
'phone' => 'required|string',
'email' => 'required|string|email|max:255|',
'subject' => 'required|string',
'message' => 'required|string',
]);
$email_company = '[email protected]';
Mail::to($email_company)->send(new SendEmail($request));

return ApiResponse::success();
} catch (Exception $e) {

return ApiResponse::failed($e);
}
}

}
18 changes: 18 additions & 0 deletions src/Facades/LandyTheme.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<?php

namespace Uasoft\Badaso\Theme\LandyTheme\Facades;

use Illuminate\Support\Facades\Facade;

class LandyTheme extends Facade
{
/**
* Get the registered name of the component.
*
* @return string
*/
protected static function getFacadeAccessor()
{
return 'badaso-landy-theme';
}
}
13 changes: 13 additions & 0 deletions src/Helpers/CaseConvert.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<?php

namespace Uasoft\Badaso\Theme\LandyTheme\Helpers;

class CaseConvert
{
public static function slugToCapitalize($string)
{
$modified_string = str_replace('-', ' ', $string);

return ucwords($modified_string);
}
}
20 changes: 20 additions & 0 deletions src/Helpers/Route.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<?php

namespace Uasoft\Badaso\Theme\LandyTheme\Helpers;

class Route
{
public static function getController($key)
{
// get config 'controllers' from config/badaso-landy-theme.php
$controllers = config('badaso-landy-theme.controllers');

// if the key is not found, return $key
if (!isset($controllers[$key])) {
return 'Uasoft\\Badaso\\Theme\\LandyTheme\\Controllers\\'.$key;
}

// return the value of the key
return $controllers[$key];
}
}
Binary file added src/Images/.DS_Store
Binary file not shown.
1 change: 1 addition & 0 deletions src/Images/facebook.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions src/Images/instagram.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/Images/landy-img/.DS_Store
Binary file not shown.
Binary file added src/Images/landy-img/about-img1.jpeg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/Images/landy-img/author-1.jpeg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/Images/landy-img/author-4.jpeg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/Images/landy-img/author-5.jpeg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
12 changes: 12 additions & 0 deletions src/Images/landy-img/ayroui.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/Images/landy-img/capsule.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/Images/landy-img/dashboard.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit 0ce576b

Please sign in to comment.