Skip to content

Commit

Permalink
Scroll entire main column all together (#2868)
Browse files Browse the repository at this point in the history
  • Loading branch information
eemeli authored Jun 19, 2023
1 parent 5a6f16b commit 69a2076
Show file tree
Hide file tree
Showing 10 changed files with 50 additions and 51 deletions.
3 changes: 0 additions & 3 deletions translate/public/locale/en-US/translate.ftl
Original file line number Diff line number Diff line change
Expand Up @@ -276,9 +276,6 @@ entitydetails-Metadata--context =
entitydetails-Metadata--placeholder =
.title = PLACEHOLDER EXAMPLES
entitydetails-Metadata--resource =
.title = RESOURCE
entitydetails-Metadata--attribute =
.title = FLUENT ATTRIBUTE
Expand Down
3 changes: 0 additions & 3 deletions translate/public/locale/fr/translate.ftl
Original file line number Diff line number Diff line change
Expand Up @@ -111,9 +111,6 @@ entitydetails-Metadata--context =
entitydetails-Metadata--placeholder =
.title = EXEMPLES BOUCHE-TROUS
entitydetails-Metadata--resource =
.title = RESSOURCE
## Entity Details PluralString
## Shows the original string of an entity with plural forms
Expand Down
1 change: 0 additions & 1 deletion translate/src/App.css
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@

#app > .main-content > .panel-content,
#app > .main-content > .panel-list {
height: 100%;
position: relative;
}

Expand Down
2 changes: 0 additions & 2 deletions translate/src/modules/editor/components/Editor.css
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,5 @@
border-bottom: 1px solid #5e6475;
display: flex;
flex-direction: column;
flex-shrink: 0;
min-height: 160px;
position: relative;
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
}

.entity-details .main-column {
display: flex;
flex-direction: column;
max-height: 100%;
overflow-y: auto;
width: 66.67%;
}

Expand Down
13 changes: 9 additions & 4 deletions translate/src/modules/entitydetails/components/Metadata.css
Original file line number Diff line number Diff line change
@@ -1,13 +1,10 @@
.metadata {
background-color: #3f4752;
color: #aaa;
flex-shrink: 0;
font-size: 12px;
font-style: italic;
height: 20%;
min-height: 100px;
min-height: 114px;
line-height: 22px;
overflow: auto;
padding: 10px;
}

Expand Down Expand Up @@ -94,3 +91,11 @@
.metadata .resource-comment button {
white-space: nowrap;
}

.metadata .context a {
color: #aaa;
}

.metadata .context a:hover {
color: #7bc876;
}
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ describe('<Metadata>', () => {
);

expect(
wrapper.find('#entitydetails-Metadata--resource a.resource-path').text(),
wrapper.find('#entitydetails-Metadata--context a.resource-path').text(),
).toContain(ENTITY.path);
});

Expand Down
68 changes: 38 additions & 30 deletions translate/src/modules/entitydetails/components/Metadata.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -116,14 +116,6 @@ function ResourceComment({ comment }: { comment: string }) {
);
}

function EntityContext({ context }: { context: string }) {
return (
<Datum className='context' id='context' title='CONTEXT'>
{context}
</Datum>
);
}

function SourceArray({ source }: { source: string[][] }) {
return source.length > 1 || (source.length === 1 && source[0]) ? (
<ul>
Expand Down Expand Up @@ -161,6 +153,39 @@ function SourceObject({
);
}

const EntityContext = ({
entity: { context, path, project },
localeCode,
navigateToPath,
}: {
entity: Entity;
localeCode: string;
navigateToPath: (path: string) => void;
}) => (
<Localized id='entitydetails-Metadata--context' attrs={{ title: true }}>
<Property title='CONTEXT' className='context'>
{context ? (
<>
{context}
<span className='divider'>&bull;</span>
</>
) : null}
<a
href={`/${localeCode}/${project.slug}/${path}/`}
onClick={(ev) => {
ev.preventDefault();
navigateToPath(ev.currentTarget.pathname);
}}
className='resource-path'
>
{path}
</a>
<span className='divider'>&bull;</span>
<a href={`/${localeCode}/${project.slug}/`}>{project.name}</a>
</Property>
</Localized>
);

/**
* Component showing metadata of an entity.
*
Expand All @@ -186,14 +211,6 @@ export function Metadata({
}: Props): React.ReactElement {
const { code } = useContext(Locale);

const navigateToPath_ = useCallback(
(ev: React.MouseEvent<HTMLAnchorElement>) => {
ev.preventDefault();
navigateToPath(ev.currentTarget.pathname);
},
[navigateToPath],
);

const openTeamComments = useCallback(() => {
const teamCommentsTab = commentTabRef.current;
const index = teamCommentsTab?._reactInternalFiber.index ?? 0;
Expand All @@ -216,25 +233,16 @@ export function Metadata({
<GroupComment comment={entity.group_comment} />
<ResourceComment comment={entity.resource_comment} key={entity.pk} />
<FluentAttribute entity={entity} />
<EntityContext context={entity.context} />
{Array.isArray(entity.source) ? (
<SourceArray source={entity.source} />
) : entity.source ? (
<SourceObject source={entity.source} />
) : null}
<Localized id='entitydetails-Metadata--resource' attrs={{ title: true }}>
<Property title='RESOURCE' className='resource'>
<a href={`/${code}/${entity.project.slug}/`}>{entity.project.name}</a>
<span className='divider'>&bull;</span>
<a
href={`/${code}/${entity.project.slug}/${entity.path}/`}
onClick={navigateToPath_}
className='resource-path'
>
{entity.path}
</a>
</Property>
</Localized>
<EntityContext
entity={entity}
localeCode={code}
navigateToPath={navigateToPath}
/>
</div>
);
}
3 changes: 0 additions & 3 deletions translate/src/modules/history/components/History.css
Original file line number Diff line number Diff line change
@@ -1,13 +1,10 @@
.history {
line-height: 22px;
overflow: hidden;
}

.history ul {
height: 100%;
list-style: none;
margin: 0;
overflow: auto;
padding: 0;
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
.translationform {
height: 100%;
line-height: 22px;
padding: 10px;
overflow: auto;
}

.translationform table {
Expand Down

0 comments on commit 69a2076

Please sign in to comment.