Skip to content

Commit

Permalink
Apply fixes from StyleCI
Browse files Browse the repository at this point in the history
  • Loading branch information
joelbutcher authored and StyleCIBot committed Oct 12, 2023
1 parent 13b5c68 commit 177c1e9
Show file tree
Hide file tree
Showing 11 changed files with 58 additions and 55 deletions.
1 change: 0 additions & 1 deletion config/filament.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
<?php

use JoelButcher\Socialstream\Features;
use JoelButcher\Socialstream\Providers;

return [
Expand Down
5 changes: 0 additions & 5 deletions src/Actions/Auth/Filament/AuthenticateOauthCallback.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,13 @@

namespace JoelButcher\Socialstream\Actions\Auth\Filament;

use Illuminate\Contracts\Auth\Authenticatable;
use Illuminate\Contracts\Auth\Guard;
use Illuminate\Http\RedirectResponse;
use Illuminate\Http\Response;
use Illuminate\Support\MessageBag;
use JoelButcher\Socialstream\ConnectedAccount;
use JoelButcher\Socialstream\Contracts\AuthenticatesOauthCallback;
use JoelButcher\Socialstream\Contracts\CreatesConnectedAccounts;
use JoelButcher\Socialstream\Contracts\CreatesUserFromProvider;
use JoelButcher\Socialstream\Contracts\UpdatesConnectedAccounts;
use JoelButcher\Socialstream\Features;
use JoelButcher\Socialstream\Providers;
use JoelButcher\Socialstream\Socialstream;
use Laravel\Socialite\Contracts\User as ProviderUser;

Expand Down
1 change: 0 additions & 1 deletion src/Installer/InstallManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ class InstallManager extends Manager
{
public function getDefaultDriver(): void
{

}

public function createBreezeBladeDriver(): BladeDriver
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,21 +5,15 @@ export default function ConnectedAccount({ children, provider, connectedAccount
<div>
<div className="px-3 flex items-center justify-between">
<div className="flex items-center">
<ProviderIcon provider={provider} className="h-6 w-6"/>
<ProviderIcon provider={provider} className="h-6 w-6" />

<div className="ml-2">
<div className="text-sm font-semibold text-gray-600 dark:text-gray-400">
{provider.name}
</div>
<div className="text-sm font-semibold text-gray-600 dark:text-gray-400">{provider.name}</div>

{connectedAccount?.created_at ? (
<div className="text-xs text-gray-500">
Connected {connectedAccount.created_at}
</div>
<div className="text-xs text-gray-500">Connected {connectedAccount.created_at}</div>
) : (
<div className="text-xs text-gray-500">
Not connected.
</div>
<div className="text-xs text-gray-500">Not connected.</div>
)}
</div>
</div>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,30 +1,30 @@
import InputError from '@/Components/InputError.jsx';
import ProviderIcon from '@/Components/SocialstreamIcons/ProviderIcon.jsx';

export default function Socialstream({prompt, providers, error}) {
export default function Socialstream({ prompt, providers, error }) {
return (
<div className="space-y-6 mt-6 mb-2">
<div className="relative flex items-center">
<div className="flex-grow border-t border-gray-400 dark:border-gray-500"></div>
<span className="flex-shrink text-gray-400 dark:text-gray-500 mx-6">
{prompt}
</span>
<span className="flex-shrink text-gray-400 dark:text-gray-500 mx-6">{prompt}</span>
<div className="flex-grow border-t border-gray-400 dark:border-gray-500"></div>
</div>

{error && <InputError message={error} className="text-center"/>}
{error && <InputError message={error} className="text-center" />}

<div className="grid gap-4">
{providers.map(provider => {
{providers.map((provider) => {
return (
<a
key={provider.id}
href={route('oauth.redirect', provider.id)}
className="inline-flex justify-center items-center gap-2 py-3 bg-white dark:bg-gray-800 border border-gray-300 dark:border-gray-500 rounded-md font-semibold text-gray-700 dark:text-gray-300 shadow-sm hover:bg-gray-50 dark:hover:bg-gray-700 focus:outline-none focus:ring-2 focus:ring-indigo-500 focus:ring-offset-2 dark:focus:ring-offset-gray-800 disabled:opacity-25 transition ease-in-out duration-150"
>
<ProviderIcon provider={provider} className="h-6 w-6"/>
<ProviderIcon provider={provider} className="h-6 w-6" />

<span class="block font-medium text-sm text-gray-700 dark:text-gray-300">{provider.buttonLabel || provider.name}</span>
<span class="block font-medium text-sm text-gray-700 dark:text-gray-300">
{provider.buttonLabel || provider.name}
</span>
</a>
);
})}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,31 +9,31 @@ import Twitter from '@/Components/SocialstreamIcons/Twitter.jsx';

export default function ProviderIcon({ className = '', provider, ...props }) {
const Icon = () => {
switch(provider.id) {
switch (provider.id) {
case 'bitbucket':
return <Bitbucket {...props} className={className} />
return <Bitbucket {...props} className={className} />;
case 'facebook':
return <Facebook {...props} className={className} />
return <Facebook {...props} className={className} />;
case 'github':
return <Github {...props} className={className} />
return <Github {...props} className={className} />;
case 'gitlab':
return <Gitlab {...props} className={className} />
return <Gitlab {...props} className={className} />;
case 'google':
return <Google {...props} className={className} />
return <Google {...props} className={className} />;
case 'linkedin':
case 'linkedin-openid':
return <Linkedin {...props} className={className} />
return <Linkedin {...props} className={className} />;
case 'slack':
return <Slack {...props} className={className} />
return <Slack {...props} className={className} />;
case 'twitter':
case 'twitter-oauth-2':
return <Twitter {...props} className={className} />
return <Twitter {...props} className={className} />;
}
};

return (
<div className="text-gray-900 dark:text-gray-100">
<Icon />
</div>
)
);
}
6 changes: 5 additions & 1 deletion stubs/breeze/inertia-react/resources/js/Pages/Auth/Login.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,11 @@ export default function Login({
</form>

{socialstream.show && socialstream.providers.length > 0 && (
<Socialstream prompt={socialstream.prompt} error={socialstreamErrors} providers={socialstream.providers} />
<Socialstream
prompt={socialstream.prompt}
error={socialstreamErrors}
providers={socialstream.providers}
/>
)}
</GuestLayout>
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,11 @@ export default function Register({ socialstream, errors: { socialstream: socials
</form>

{socialstream.show && socialstream.providers.length > 0 && (
<Socialstream prompt={socialstream.prompt} error={socialstreamErrors} providers={socialstream.providers} />
<Socialstream
prompt={socialstream.prompt}
error={socialstreamErrors}
providers={socialstream.providers}
/>
)}
</GuestLayout>
);
Expand Down
12 changes: 10 additions & 2 deletions stubs/breeze/inertia-react/resources/js/Pages/Profile/Edit.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,20 @@ export default function Edit({ auth, mustVerifyEmail, status, socialstream }) {
</div>

<div className="p-4 sm:p-8 bg-white dark:bg-gray-800 shadow sm:rounded-lg">
{socialstream.hasPassword ? <UpdatePasswordForm className="max-w-xl" /> : <SetPasswordForm className="max-w-xl" />}
{socialstream.hasPassword ? (
<UpdatePasswordForm className="max-w-xl" />
) : (
<SetPasswordForm className="max-w-xl" />
)}
</div>

{socialstream.show && (
<div className="p-4 sm:p-8 bg-white dark:bg-gray-800 shadow sm:rounded-lg">
<ConnectedAccountsForm providers={socialstream.providers} connectedAccounts={socialstream.connectedAccounts} hasPassword={socialstream.hasPassword} />
<ConnectedAccountsForm
providers={socialstream.providers}
connectedAccounts={socialstream.connectedAccounts}
hasPassword={socialstream.hasPassword}
/>
</div>
)}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,26 +53,29 @@ export default function ConnectedAccountsForm({ className = '', hasPassword, pro
<h2 className="text-lg font-medium text-gray-900 dark:text-gray-100">Connected Accounts</h2>

<p className="max-w-xl mt-1 text-sm text-gray-600 dark:text-gray-400">
You are free to connect any social accounts to your profile and may remove any connected accounts at any
time. If you feel any of your connected accounts have been compromised, you should disconnect them
immediately and change your password.
You are free to connect any social accounts to your profile and may remove any connected accounts at
any time. If you feel any of your connected accounts have been compromised, you should disconnect
them immediately and change your password.
</p>
</header>

<div className="mt-5 space-y-6">
{providers.map(provider => {
{providers.map((provider) => {
const connectedAccount = connectedAccounts
.filter(account => account.provider === provider.id)
.filter((account) => account.provider === provider.id)
.shift();

return (
<React.Fragment key={provider.id}>
<ConnectedAccount provider={provider} connectedAccount={connectedAccount}>
{connectedAccount ?
(connectedAccounts.length > 1 || hasPassword && <DangerButton onClick={confirmAccountDeletion}>Remove</DangerButton>)
: (
<ActionLink href={route('oauth.redirect', { provider })}>Connect</ActionLink>
)}
{connectedAccount ? (
connectedAccounts.length > 1 ||
(hasPassword && (
<DangerButton onClick={confirmAccountDeletion}>Remove</DangerButton>
))
) : (
<ActionLink href={route('oauth.redirect', { provider })}>Connect</ActionLink>
)}
</ConnectedAccount>

{connectedAccount && (
Expand All @@ -87,7 +90,7 @@ export default function ConnectedAccountsForm({ className = '', hasPassword, pro
</p>

<div className="mt-6">
<InputLabel htmlFor="password" value="Password" className="sr-only"/>
<InputLabel htmlFor="password" value="Password" className="sr-only" />

<TextInput
id="password"
Expand All @@ -101,7 +104,7 @@ export default function ConnectedAccountsForm({ className = '', hasPassword, pro
placeholder="Password"
/>

<InputError message={errors.password} className="mt-2"/>
<InputError message={errors.password} className="mt-2" />
</div>

<div className="mt-6 flex justify-end">
Expand All @@ -115,7 +118,7 @@ export default function ConnectedAccountsForm({ className = '', hasPassword, pro
</Modal>
)}
</React.Fragment>
)
);
})}
</div>
</section>
Expand Down
3 changes: 0 additions & 3 deletions tests/Unit/DriverTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
{
protected function ensureDependenciesAreInstalled(string $composerBinary, InstallOptions ...$options): void
{

}
};

Expand All @@ -31,7 +30,6 @@ protected function ensureDependenciesAreInstalled(string $composerBinary, Instal
{
protected function ensureDependenciesAreInstalled(string $composerBinary, InstallOptions ...$options): void
{

}
};

Expand All @@ -50,7 +48,6 @@ protected function ensureDependenciesAreInstalled(string $composerBinary, Instal
{
protected function ensureDependenciesAreInstalled(string $composerBinary, InstallOptions ...$options): void
{

}
};

Expand Down

0 comments on commit 177c1e9

Please sign in to comment.