Skip to content

Commit 85deaec

Browse files
authored
Merge pull request #203 from cachho/style/Popup
style: sort agents alphabetically
2 parents 8acc073 + 019e909 commit 85deaec

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/components/Popup.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import { defaultSettings, settingNames } from '../models/Settings';
1010
const Popup = () => {
1111
const [settings, setSettings] = useState<Settings>(defaultSettings);
1212
const storage = getStorage();
13+
const sortedAgents = agents.slice().sort((a, b) => a.localeCompare(b));
1314

1415
function setValues(updatedSettings: Partial<Settings>) {
1516
setSettings((prevSettings) => ({
@@ -109,7 +110,7 @@ const Popup = () => {
109110
</p>
110111
<h2 style={{ textAlign: 'center' }}>My Shopping Agent</h2>
111112
<select onChange={handleChangeMyAgent} value={settings.myAgent}>
112-
{agentsWithRaw.map((agent) => (
113+
{[...sortedAgents, 'raw'].map((agent) => (
113114
<option value={agent} key={`my-agent-select-${agent}`}>
114115
{agent}
115116
</option>
@@ -230,7 +231,7 @@ const Popup = () => {
230231
{settings.showToolbar ? (
231232
<>
232233
<h4>toolbar includes:</h4>
233-
{agents.map((agent) => {
234+
{sortedAgents.map((agent) => {
234235
const checked = settings.agentsInToolbar.includes(agent);
235236

236237
function swap() {

0 commit comments

Comments
 (0)