Skip to content

Commit

Permalink
added group description and added translate
Browse files Browse the repository at this point in the history
  • Loading branch information
febrihidayan committed Aug 11, 2021
1 parent f12bb3f commit a5485fe
Show file tree
Hide file tree
Showing 9 changed files with 45 additions and 22 deletions.
2 changes: 1 addition & 1 deletion public/css/app.css

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion public/js/app.js

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions public/mix-manifest.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
"/js/app.js": "/js/app.js?id=8f33a72d7e234e049918",
"/css/app.css": "/css/app.css?id=6c398fb57947c3b7f373"
"/js/app.js": "/js/app.js?id=109b8aa438be2bc026f3",
"/css/app.css": "/css/app.css?id=aebc21af4c3e8045aafc"
}
24 changes: 13 additions & 11 deletions resources/js/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -765,21 +765,23 @@
`${trans.made} ${message.last_time} ${trans.at} ${message.time}`
}}</small>
</div>
<div class="bg-white dark:bg-dark-300 my-2 px-6 py-4">
<small class="text-purple-800 dark:text-purple-300">{{
<div class="flex flex-col bg-white dark:bg-dark-300 my-2 pl-6">
<small class="text-purple-800 dark:text-purple-300 pt-4">{{
message.chat_type === models.message.type_user
? trans.info_and_email_address
: trans.description
}}</small>
<div class="mt-4">
<p v-if="message.bio">{{
message.bio
}}</p>
<p>{{
message.chat_type === models.message.type_user
? message.email : message.description
}}</p>
</div>
<p
v-if="message.bio"
class="py-4 border-b dark:border-gray-500"
>{{
message.bio
}}</p>
<p class="py-4">{{
message.chat_type === models.message.type_user
? message.email
: (message.description || trans.add_group_description)
}}</p>
</div>
<div
v-if="message.chat_type === models.message.type_group"
Expand Down
4 changes: 2 additions & 2 deletions resources/js/components/modules/Media.vue
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<template>
<div
:class="[`media flex h-18 dark:divide-gray-500`, {
:class="[`media flex h-18`, {
'cursor-pointer': cursor,
'hover:bg-light-300 dark:hover:bg-true-gray-700': cursor && !isActive,
'bg-light-500 dark:bg-true-gray-800': isActive
Expand Down Expand Up @@ -40,6 +40,6 @@ export default {

<style scoped>
.media + .media {
@apply divide-y;
@apply divide-y dark:divide-gray-500;
}
</style>
4 changes: 3 additions & 1 deletion resources/lang/en/app.php
Original file line number Diff line number Diff line change
@@ -1,15 +1,17 @@
<?php

return [
'add_group_description' => 'Add group description',
'at' => 'at',
'cancel' => 'Cancel',
'change_language' => 'Change language',
'contact_info' => 'Contact info',
'dark' => 'Dark',
'delete_chat' => 'Delete chat',
'delete_this_chat' => 'Delete this chat?',
'friday' => 'Friday',
'description' => 'Description',
'exit' => 'Exit',
'friday' => 'Friday',
'group_admin' => 'Group admin',
'group_info' => 'Group info',
'group_name' => 'Group name',
Expand Down
1 change: 1 addition & 0 deletions resources/lang/id/app.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<?php

return [
'add_group_description' => 'Tambahkan deskripsi grup',
'at' => 'pukul',
'cancel' => 'Batal',
'change_language' => 'Ganti bahasa',
Expand Down
9 changes: 6 additions & 3 deletions src/Http/Controllers/Messages/ShowController.php
Original file line number Diff line number Diff line change
Expand Up @@ -117,19 +117,22 @@ public function __invoke($id)

$data += [
'id' => $first->id,
'avatar' => Laratalk::gravatar($first->email),
'avatar' => Config::userGravatar()
? Laratalk::gravatar($first->email)
: $first->{Config::userAvatar()},
'name' => $first->name,
'email' => $first->email,
'bio' => $first->{Config::userBio()},
];
} else {
$first = Group::with('users')
->find($id);

$data += [
'id' => $first->id,
'avatar' => $first->avatar,
'avatar' => $first->avatar ?? '',
'name' => $first->name,
'description' => $first->description,
'description' => $first->description ?? '',
'last_time' => Laratalk::lastTime($first->created_at, true),
'time' => $first-> created_at->format('H.i'),
'users' => UserGroupResource::collection($first->users)
Expand Down
17 changes: 16 additions & 1 deletion src/Http/Resources/Messages/ShowGroupResource.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

namespace FebriHidayan\Laratalk\Http\Resources\Messages;

use FebriHidayan\Laratalk\Config;
use FebriHidayan\Laratalk\Models\Message;
use Illuminate\Http\Resources\Json\JsonResource;
use Illuminate\Support\Facades\Auth;
Expand Down Expand Up @@ -44,9 +45,23 @@ public function toArray($request)
];

if (in_array($this->type, $types)) {
$usersName = '';

if ($this->recipients->count() > 0) {
$usersName = Config::userModel()::whereIn(
'id',
$this->recipients->pluck('to_id')
)
->get()
->pluck('name');
}
else {
$usersName = $this->recipient->user->name;
}

$data += [
'content_to' => $this->recipient->to_id,
'user_to_name' => $this->recipient->user->name,
'user_to_name' => $usersName
];
}

Expand Down

0 comments on commit a5485fe

Please sign in to comment.