diff --git a/src/app/components/main-chat/single-chat/attachments/attachments.component.scss b/src/app/components/main-chat/single-chat/attachments/attachments.component.scss
index d051c70..7b9ed6e 100644
--- a/src/app/components/main-chat/single-chat/attachments/attachments.component.scss
+++ b/src/app/components/main-chat/single-chat/attachments/attachments.component.scss
@@ -2,9 +2,9 @@
.files {
display: flex;
-
max-width: calc(100vw - 140px);
overflow: auto;
+ margin-top: 12px;
.filesView {
cursor: pointer;
transition: 0.3s ease-in-out;
diff --git a/src/app/components/sidebar/sidebar-channels/add-new-channel/add-new-channel.component.ts b/src/app/components/sidebar/sidebar-channels/add-new-channel/add-new-channel.component.ts
index ebc2e2b..7037736 100644
--- a/src/app/components/sidebar/sidebar-channels/add-new-channel/add-new-channel.component.ts
+++ b/src/app/components/sidebar/sidebar-channels/add-new-channel/add-new-channel.component.ts
@@ -154,11 +154,13 @@ export class AddNewChannelComponent {
/**
* Check if channel is allready existing.
- * @param channelName
- * @returns
+ * @param channelName
+ * @returns
*/
- chechIfChannelExist(channelName: string){
- const filterChannel = this.channelService.allChannels.some(channel => channel.name === channelName);
+ chechIfChannelExist(channelName: string) {
+ const filterChannel = this.channelService.allChannels.some(
+ (channel) => channel.name === channelName
+ );
if (filterChannel) {
return true;
} else {
@@ -178,6 +180,7 @@ export class AddNewChannelComponent {
hashtag: this.channelName,
createdDate: this.currentDate,
addedUser: this.checkUserArray(),
+ index: this.lastChannelIndex() + 1,
};
const channelId = await this.channelService.createNewChannel(
newChannel,
@@ -190,6 +193,17 @@ export class AddNewChannelComponent {
this.route.navigateByUrl(`main/${channelId}`);
}
+ /**
+ * Calculates the index of the last channel and returns the next available index.
+ * @returns {number} The next available channel index.
+ */
+ lastChannelIndex(): number {
+ const channels = this.channelService.allChannels.filter(
+ (channel) => channel.index !== undefined && channel.index !== null
+ );
+ return Math.max(...channels.map((channel) => channel.index));
+ }
+
/**
* Checks the user array.
* @returns The user array.
diff --git a/src/app/components/sidebar/sidebar-channels/sidebar-channels.component.html b/src/app/components/sidebar/sidebar-channels/sidebar-channels.component.html
index c26f8f6..00c08da 100644
--- a/src/app/components/sidebar/sidebar-channels/sidebar-channels.component.html
+++ b/src/app/components/sidebar/sidebar-channels/sidebar-channels.component.html
@@ -8,7 +8,7 @@
class="arrowImg"
/>
-
{{ 'sidebar-channels.channel' | translate }}
+{{ "sidebar-channels.channel" | translate }}
{{ 'sidebar-channels.addChannel' | translate }}
+{{ "sidebar-channels.addChannel" | translate }}