Skip to content

Commit

Permalink
🛠 Fix tailwind UI and more (linagora#2337)
Browse files Browse the repository at this point in the history
* Fix linagora#2332

* Fix bad file format in response and fix linagora#2329

* Make sure badly formatted files are not returned

* Go back to css
  • Loading branch information
RomaricMourgues authored Jun 21, 2022
1 parent 5ce251d commit 61ae37f
Show file tree
Hide file tree
Showing 20 changed files with 80 additions and 39 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -143,4 +143,5 @@ userreport.sh

private

log-workforce.sh
log-workforce.sh
.dccache
2 changes: 2 additions & 0 deletions twake/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839

*.DS_Store
*.dccache
.dccache

# User-specific stuff:
.idea/**/workspace.xml
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@ export type MessageFileMetadata = {
mime?: string; //Original file mime
size?: number; //Original file weight
thumbnails?: Thumbnail[]; //Url to thumbnail (or set it to undefined if no relevant)
type?: string;
};

export type MessageFilePrimaryKey = Pick<MessageFile, "message_id" | "id">;
20 changes: 14 additions & 6 deletions twake/backend/node/src/services/messages/services/messages.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ import {
ReactionOperation,
ThreadExecutionContext,
} from "../types";
import _, { first } from "lodash";
import _, { first, pick } from "lodash";
import { getThreadMessagePath, getThreadMessageWebsocketRoom } from "../web/realtime";
import { ThreadMessagesOperationsService } from "./messages-operations";
import { Thread, ThreadPrimaryKey } from "../entities/threads";
Expand Down Expand Up @@ -752,11 +752,19 @@ export class ThreadMessagesService implements MessageThreadMessagesServiceAPI {
company: { id: file.metadata.external_id?.company_id as string },
});
if (original) {
file.metadata = { ...file.metadata, ...original.metadata };
file.metadata.thumbnails = (file.metadata.thumbnails || []).map((t, index) => {
t.url = gr.services.files.getThumbnailRoute(original, (t.index || index).toString());
return t;
});
file.metadata = {
...file.metadata,
..._.pick(original.metadata, "mime", "name"),
..._.pick(original.upload_data, "size"),
source: "internal",
external_id: file.metadata.external_id,
};
file.metadata.thumbnails = (file.metadata.thumbnails || original.thumbnails || []).map(
(t, index) => {
t.url = gr.services.files.getThumbnailRoute(original, (t.index || index).toString());
return t;
},
);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ export default async (
);

return {
resources: userFiles.getEntities().filter(a => a) as FileSearchResult[],
resources: userFiles.getEntities().filter(a => a?.metadata?.external_id) as FileSearchResult[],
next_page_token: userFiles?.nextPage?.page_token,
};
};
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ export default async (
}>,
context: ChannelViewExecutionContext,
): Promise<ResourceListResponse<MessageFile>> => {
if (isEmpty(request)) {
if (isEmpty(request.query)) {
return recentFiles(request);
}

Expand Down Expand Up @@ -119,7 +119,9 @@ export default async (
}
}

messageFiles = messageFiles.filter(mf => mf.message.subtype !== "deleted");
messageFiles = messageFiles
.filter(mf => mf.message.subtype !== "deleted")
.filter(a => a?.metadata?.external_id);

return {
resources: messageFiles,
Expand Down
10 changes: 10 additions & 0 deletions twake/frontend/public/styles/tailwind.css
Original file line number Diff line number Diff line change
Expand Up @@ -2118,6 +2118,16 @@ select {
transition-timing-function: cubic-bezier(0.4, 0, 1, 1);
}

input.ant-input {
background-color: transparent;
}

[type='text'], [type='email'], [type='url'], [type='password'], [type='number'], [type='date'], [type='datetime-local'], [type='month'], [type='search'], [type='tel'], [type='time'], [type='week'], [multiple], textarea, select {
&, &:hover {
border-color: var(--grey-light);
}
}

.focus-within\:z-10:focus-within {
z-index: 10;
}
Expand Down
2 changes: 1 addition & 1 deletion twake/frontend/src/app/app.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ import InitService from './features/global/services/init-service';
import useTimeout from 'app/features/global/hooks/use-timeout';
import ApplicationLoader from './components/loader/application-loader';

import 'app/styles/index.less';
import DebugState from './components/debug/debug-state';
import 'app/styles/index.less';

const delayMessage = 5000;

Expand Down
2 changes: 1 addition & 1 deletion twake/frontend/src/app/atoms/button/button.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ export const Button = (props: ButtonProps) => {
<button
type="button"
className={
'inline-flex items-center px-4 py-2 border text-sm font-medium rounded-md focus:outline-none ' +
' inline-flex items-center px-4 py-2 border text-sm font-medium rounded-md focus:outline-none ' +
colors +
' ' +
props.className
Expand Down
2 changes: 2 additions & 0 deletions twake/frontend/src/app/components/banner/banner.scss
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@


.ant-layout-header.banner-container {
padding: 0 16px;

Expand Down
2 changes: 1 addition & 1 deletion twake/frontend/src/app/components/buttons/button.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ export default class Button extends React.Component {
<button
ref={this.props.refButton}
{...this.props}
className={'button ' + className}
className={'button no-tw ' + className}
onClick={evt => {
evt.target.blur();
this.props.onClick && this.props.onClick(evt);
Expand Down
20 changes: 10 additions & 10 deletions twake/frontend/src/app/components/buttons/buttons.scss
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@
}
}

.button {
background: var(--primary);
.button, .button.no-tw {
background-color: var(--primary);
color: var(--white);
font-weight: 500;
border: 0px;
Expand All @@ -49,17 +49,17 @@
cursor: pointer;

&:hover {
background: var(--primary-hover);
background-color: var(--primary-hover);
}
&:active {
background: var(--primary);
background-color: var(--primary);
}
&:focus {
outline: none;
}
&.disabled,
&:disabled {
background: var(--primary-background);
background-color: var(--primary-background);
pointer-events: none;
}

Expand Down Expand Up @@ -117,7 +117,7 @@
}

&.secondary-light {
background: var(--grey-light);
background-color: var(--grey-light);
color: var(--black);

&:hover,
Expand All @@ -126,7 +126,7 @@
}
&.disabled,
&:disabled {
background: var(--grey-background);
background-color: var(--grey-background);
color: var(--grey-dark);
}
}
Expand All @@ -148,10 +148,10 @@
}
&:hover {
color: var(--primary-hover);
// background: var(--primary-background);
// background-color: var(--primary-background);
}
&:active {
// background: var(--primary-background);
// background-color: var(--primary-background);
}
}

Expand All @@ -172,7 +172,7 @@
}
&:hover {
color: var(--black);
//background: var(--grey-background);
//background-color: var(--grey-background);
}
&:active {
color: var(--black);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import Api from 'app/features/global/framework/api-service';
import { FileType, MetaDataType } from 'app/features/files/types/file';
import { FileType } from 'app/features/files/types/file';
import { MessageFileType } from 'app/features/messages/types/message';
import extensionToMime from '../utils/extension-to-mime';
import { fileTypeMimes } from '../utils/type-mimes';
Expand Down
4 changes: 0 additions & 4 deletions twake/frontend/src/app/features/files/types/file.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,6 @@ export type MetaDataType = {
name: string;
mime: string;
thumbnails_status?: string;
external_id?: {
id: string;
company_id: string;
};
};

export type FileUploadDataObjectType = {
Expand Down
14 changes: 9 additions & 5 deletions twake/frontend/src/app/styles/themes/antd-theme.less
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,13 @@
font-size: 17px;
}

button.ant-btn-primary {
background-color: @primary;
}

.ant-btn-primary:hover,
.ant-btn-primary:focus {
background: @primary-hover;
background-color: @primary-hover;
}

.ant-btn-ghost,
Expand Down Expand Up @@ -153,11 +157,11 @@ textarea.ant-input,
}

// --- antd-layout-header --- //
@layout-header-background: @white;
@layout-header-background-color: @white;

// --- ant-layout-sider ---//
@layout-body-background: @white;
@layout-sider-background: @secondary;
@layout-body-background-color: @white;
@layout-sider-background-color: @secondary;
@layout-sider-background-light: @grey-background;

.ant-layout-sider-zero-width-trigger {
Expand Down Expand Up @@ -196,7 +200,7 @@ textarea.ant-input,
}

// --- ant-select --- //
@select-background: @grey-background;
@select-background-color: @grey-background;
@select-border-color: @grey-background;
@select-dropdown-bg: @white;
@select-item-active-bg: @primary-background;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,8 @@ export default (props: Props) => {
})
}
>
<CornerDownRight size={14} /> {Languages.t('scenes.apps.messages.message.reply_button')}
<CornerDownRight size={14} className="inline" />{' '}
{Languages.t('scenes.apps.messages.message.reply_button')}
</span>
</div>
</ThreadSection>
Expand Down
2 changes: 2 additions & 0 deletions twake/frontend/src/app/views/client/main-view/MainView.scss
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
.global-view-header {
padding: 8px 0;
height: 56px;
background-color: #FFF;

.ant-divider {
margin: 0;
Expand Down Expand Up @@ -83,6 +84,7 @@
display: flex;

.main-view-tabs-header {
background-color: #FFF;
height: 47px;
margin-top: -8px;
padding: 0 8px;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ export default ({
]}
position="top"
>
{!children && <CurrentCompanyLogo withCompanyName={withCompanyName} />}
{!children && <CurrentCompanyLogo showBadge withCompanyName={withCompanyName} />}
{!!children && children}
</Menu>
);
Expand All @@ -74,9 +74,11 @@ export default ({
export const CurrentCompanyLogo = ({
size,
withCompanyName = true,
showBadge = false,
}: {
size?: number;
withCompanyName?: boolean;
showBadge?: boolean;
}) => {
const { company } = useCurrentCompany();
const { badges } = useOtherCompanyNotifications(company?.id || '');
Expand All @@ -87,7 +89,7 @@ export const CurrentCompanyLogo = ({

return (
<div className={classNames('company-selector-container')}>
{badges.length > 0 && <div className="notification_dot" />}
{showBadge && badges.length > 0 && <div className="notification_dot" />}

<div
className={classNames('image', {
Expand Down
2 changes: 1 addition & 1 deletion twake/frontend/src/app/views/join/styles.scss
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,6 @@

.ant-btn-primary.gray-btn {
border-color: var(--grey-dark);
background: var(--grey-dark);
background-color: var(--grey-dark);
}
}
14 changes: 13 additions & 1 deletion twake/frontend/src/tailwind.css
Original file line number Diff line number Diff line change
@@ -1,3 +1,15 @@
@tailwind base;
@tailwind components;
@tailwind utilities;
@tailwind utilities;

input.ant-input {
background-color: transparent;
}

[type='text'], [type='email'], [type='url'], [type='password'], [type='number'], [type='date'], [type='datetime-local'], [type='month'], [type='search'], [type='tel'], [type='time'], [type='week'], [multiple], textarea, select {
border-color: var(--grey-light);
}

[type='text']:hover, [type='email']:hover, [type='url']:hover, [type='password']:hover, [type='number']:hover, [type='date']:hover, [type='datetime-local']:hover, [type='month']:hover, [type='search']:hover, [type='tel']:hover, [type='time']:hover, [type='week']:hover, [multiple]:hover, textarea:hover, select:hover {
border-color: var(--grey-light);
}

0 comments on commit 61ae37f

Please sign in to comment.