Skip to content

Commit 423ff6f

Browse files
committed
feat(common, validator): remove duplicate button
1 parent 34e087e commit 423ff6f

File tree

5 files changed

+3
-47
lines changed

5 files changed

+3
-47
lines changed

core/repository/src/commonMain/kotlin/com/neoutils/neoregex/core/repository/testcase/TestCasesRepository.kt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,5 @@ interface TestCasesRepository {
3636
fun setAll(testCases: List<TestCase>)
3737
fun get(uuid: Uuid) : TestCase?
3838
fun remove(uuid: Uuid)
39-
fun duplicate(uuid: Uuid): TestCase
4039
fun clear()
4140
}

core/repository/src/commonMain/kotlin/com/neoutils/neoregex/core/repository/testcase/TestCasesRepositoryImpl.kt

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -51,15 +51,6 @@ internal class TestCasesRepositoryImpl : TestCasesRepository {
5151
testCases.remove(uuid)
5252
}
5353

54-
override fun duplicate(uuid: Uuid): TestCase {
55-
56-
val newUuid = Uuid.random()
57-
58-
testCases[newUuid] = checkNotNull(get(uuid)).copy(uuid = newUuid)
59-
60-
return checkNotNull(get(newUuid))
61-
}
62-
6354
override fun setAll(testCases: List<TestCase>) {
6455
this.testCases.update {
6556
clear()

feature/validator/src/commonMain/kotlin/com/neoutils/neoregex/feature/validator/ValidatorViewModel.kt

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,8 @@ import com.neoutils.neoregex.core.common.util.ObservableMutableMap
2525
import com.neoutils.neoregex.core.repository.pattern.PatternStateRepository
2626
import com.neoutils.neoregex.core.repository.testcase.TestCasesRepository
2727
import com.neoutils.neoregex.core.sharedui.component.FooterAction
28-
import com.neoutils.neoregex.feature.validator.action.ValidatorAction
2928
import com.neoutils.neoregex.feature.validator.action.TestCaseAction
29+
import com.neoutils.neoregex.feature.validator.action.ValidatorAction
3030
import com.neoutils.neoregex.feature.validator.component.toTestCaseUi
3131
import com.neoutils.neoregex.feature.validator.model.TestCaseQueue
3232
import com.neoutils.neoregex.feature.validator.model.TestCaseValidation
@@ -290,16 +290,6 @@ class ValidatorViewModel(
290290
onRemoveTestCase(action.uuid)
291291
}
292292

293-
is TestCaseAction.Duplicate -> {
294-
addToQueue(
295-
testCasesRepository
296-
.duplicate(action.uuid)
297-
.also {
298-
expanded.value = it.uuid
299-
}
300-
)
301-
}
302-
303293
is TestCaseAction.Expanded -> {
304294
expanded.value = action.uuid
305295
}

feature/validator/src/commonMain/kotlin/com/neoutils/neoregex/feature/validator/action/TestCaseAction.kt

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -50,8 +50,4 @@ sealed class TestCaseAction {
5050
data class Expanded(
5151
val uuid: Uuid,
5252
) : TestCaseAction()
53-
54-
data class Duplicate(
55-
val uuid: Uuid,
56-
) : TestCaseAction()
5753
}

feature/validator/src/commonMain/kotlin/com/neoutils/neoregex/feature/validator/component/TestCase.kt

Lines changed: 2 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@ import androidx.compose.material.icons.Icons
3131
import androidx.compose.material.icons.outlined.Delete
3232
import androidx.compose.material.icons.outlined.ExpandCircleDown
3333
import androidx.compose.material.icons.outlined.KeyboardArrowDown
34-
import androidx.compose.material.icons.rounded.ContentCopy
3534
import androidx.compose.material3.*
3635
import androidx.compose.material3.MaterialTheme.colorScheme
3736
import androidx.compose.material3.MaterialTheme.typography
@@ -177,11 +176,6 @@ fun TestCase(
177176
TestCaseAction.Collapse(test.uuid)
178177
)
179178
},
180-
onDuplicate = {
181-
onAction(
182-
TestCaseAction.Duplicate(test.uuid)
183-
)
184-
}
185179
)
186180
}
187181
}
@@ -286,7 +280,6 @@ private fun Options(
286280
modifier: Modifier = Modifier,
287281
onDelete: () -> Unit = {},
288282
onClose: () -> Unit = {},
289-
onDuplicate: () -> Unit = {},
290283
) = Row(
291284
modifier = modifier,
292285
verticalAlignment = Alignment.CenterVertically,
@@ -318,19 +311,6 @@ private fun Options(
318311
}
319312
)
320313

321-
Icon(
322-
imageVector = Icons.Rounded.ContentCopy,
323-
contentDescription = null,
324-
modifier = Modifier
325-
.clickable(onClick = onDuplicate)
326-
.configButton(
327-
config = Config(
328-
size = 24.dp,
329-
padding = 4.dp
330-
),
331-
)
332-
)
333-
334314
Icon(
335315
imageVector = Icons.Outlined.Delete,
336316
contentDescription = null,
@@ -340,7 +320,7 @@ private fun Options(
340320
config = Config(
341321
size = 24.dp,
342322
padding = 4.dp
343-
),
323+
)
344324
)
345325
)
346326

@@ -354,7 +334,7 @@ private fun Options(
354334
config = Config(
355335
size = 24.dp,
356336
padding = 4.dp
357-
),
337+
)
358338
)
359339
)
360340
}

0 commit comments

Comments
 (0)