Skip to content

Commit 60ce8d5

Browse files
committed
minor improvements
1 parent a45e616 commit 60ce8d5

File tree

7 files changed

+7
-84
lines changed

7 files changed

+7
-84
lines changed

src/components/copy-button/copy-button.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ export class CopyButton {
3232
textArea.select();
3333
try {
3434
const success = document.execCommand('copy');
35-
console.log(`Deprecated Text copy was ${success ? 'successful' : 'unsuccessful'}.`);
35+
console.debug(`Deprecated Text copy was ${success ? 'successful' : 'unsuccessful'}.`);
3636
showSuccess();
3737
} catch (err) {
3838
console.error(err.name, err.message);
@@ -49,6 +49,8 @@ export class CopyButton {
4949
el.classList.remove('hover:bg-blue-200');
5050
el.classList.remove('bg-white');
5151
el.classList.add('bg-green-200');
52+
53+
// Reset the button after 1.5 seconds.
5254
setTimeout(() => {
5355
el.classList.remove('bg-green-200');
5456
el.classList.add('hover:bg-blue-200');
@@ -64,7 +66,6 @@ export class CopyButton {
6466
class={
6567
'bg-white border border-slate-500 text-slate-800 font-medium font-mono rounded-md px-2 py-0.5 hover:bg-blue-200 hover:text-slate-900 flex-none max-h-min items-center'
6668
}
67-
id={`copyButton-${this.value}`}
6869
onClick={event => copyValue(event, this.value)}
6970
>
7071
Copy

src/components/locale-vizualization/locale-visualization.stories.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ const meta: Meta = {
2222
},
2323
args: {
2424
locale: 'de-DE',
25+
showFlag: true,
2526
},
2627
};
2728
export default meta;

src/index.html

Lines changed: 0 additions & 38 deletions
This file was deleted.

src/rendererModules/Handle/HandleType.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,7 @@ export class HandleType extends GenericIdentifierType {
8686
}
8787

8888
this.actions.push(new FoldableAction(0, 'Open in FAIR-DOscope', `https://kit-data-manager.github.io/fairdoscope/?pid=${this._pidRecord.pid.toString()}`, 'primary'));
89+
this.actions.push(new FoldableAction(0, 'View in Handle.net registry', `https://hdl.handle.net/${this._pidRecord.pid.toString()}`, 'secondary'));
8990

9091
return;
9192
}

src/rendererModules/ORCiD/ORCIDType.tsx

Lines changed: 2 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ import { GenericIdentifierType } from '../../utils/GenericIdentifierType';
33
import { ORCIDInfo } from './ORCIDInfo';
44
import { FoldableItem } from '../../utils/FoldableItem';
55
import { FoldableAction } from '../../utils/FoldableAction';
6-
import { getLocaleDetail } from '../../utils/utils';
76

87
/**
98
* This class specifies a custom renderer for ORCiDs.
@@ -145,18 +144,7 @@ export class ORCIDType extends GenericIdentifierType {
145144
);
146145

147146
if (this._orcidInfo.preferredLocale)
148-
this.items.push(
149-
new FoldableItem(25, 'Preferred Language', this._orcidInfo.preferredLocale, 'The preferred locale/language of the person.'),
150-
// new FoldableItem(
151-
// 25,
152-
// 'Preferred Language',
153-
// getLocaleDetail(this._orcidInfo.preferredLocale, 'language'),
154-
// 'The preferred locale/language of the person.',
155-
// undefined,
156-
// undefined,
157-
// false,
158-
// ),
159-
);
147+
this.items.push(new FoldableItem(25, 'Preferred Language', this._orcidInfo.preferredLocale, 'The preferred locale/language of the person.'));
160148

161149
for (const url of this._orcidInfo.researcherUrls) {
162150
this.items.push(new FoldableItem(100, url.name, url.url, 'A link to a website specified by the person.'));
@@ -169,8 +157,7 @@ export class ORCIDType extends GenericIdentifierType {
169157

170158
if (this._orcidInfo.biography) this.items.push(new FoldableItem(200, 'Biography', this._orcidInfo.biography, 'The biography of the person.', undefined, undefined, false));
171159

172-
if (this._orcidInfo.country)
173-
this.items.push(new FoldableItem(30, 'Country', getLocaleDetail(this._orcidInfo.country, 'region'), 'The country of the person.', undefined, undefined, false));
160+
if (this._orcidInfo.country) this.items.push(new FoldableItem(30, 'Country', this._orcidInfo.country, 'The country of the person.'));
174161
}
175162
}
176163

src/utils/GenericIdentifierType.ts

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -115,15 +115,6 @@ export abstract class GenericIdentifierType {
115115
*/
116116
abstract init(data?: any): Promise<void>;
117117

118-
/**
119-
* This method indicates if a value is resolvable or not.
120-
* It could be used to resolve the value via an external API and check if the returned value is valid or even existing.
121-
* It must be implemented by the child classes as it is abstract.
122-
* @returns {boolean} Whether the value is resolvable or not.
123-
* @abstract
124-
*/
125-
abstract isResolvable(): boolean;
126-
127118
/**
128119
* This method indicates if a value has the correct format or not.
129120
* It is heavily recommended to use a regular expression to check the format.

src/utils/utils.ts

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -73,23 +73,3 @@ export const handleMap: Map<PID, PIDRecord> = new Map();
7373
* @type {Set<PID>}
7474
*/
7575
export const unresolvables: Set<PID> = new Set();
76-
77-
/**
78-
* Returns a user-friendly name of a locale.
79-
* If the locale is a language, it will return the name of the language.
80-
* If the locale is a region, it will return the flag of the region and the name of the region.
81-
* @param locale The locale to get the name of.
82-
* @param type The type of the locale.Either 'region' or 'language'.
83-
* @returns {string} The user-friendly name of the locale.
84-
*/
85-
export function getLocaleDetail(locale: string, type: 'region' | 'language'): string {
86-
const friendlyName = new Intl.DisplayNames(['en'], { type: type }).of(locale.toUpperCase());
87-
if (type === 'language') return friendlyName;
88-
89-
const codePoints = locale
90-
.toUpperCase()
91-
.split('')
92-
.map(char => 127397 + char.charCodeAt(0));
93-
const flag = String.fromCodePoint(...codePoints);
94-
return `${flag} ${friendlyName}`;
95-
}

0 commit comments

Comments
 (0)